Nativescript-cli: Support livesync with webpack

Created on 11 Jan 2018  路  9Comments  路  Source: NativeScript/nativescript-cli

Please, provide the details below:

We need to support LiveSync functionality with webpack builds. The idea is to use the webpack's watcher and rebuild the .js files when a change occur.

Which platform(s) does your issue occur on?

Both

feature

Most helpful comment

You can now use LiveSync + Webpack with the following command:

$ tns run <platform> --bundle

NOTE: This requires using the latest version of nativescript-dev-webpack

All 9 comments

You can now use LiveSync + Webpack with the following command:

$ tns run <platform> --bundle

NOTE: This requires using the latest version of nativescript-dev-webpack

tns debug <platform> --bundle can we do that? It doesn't seem to support livesync with webpack during Debug sessions

@IAMtheIAM the livesync with tns debug <platform> --bundle should work as expected (at least it works on my side with this test application) - let us know if you have troubles and post any details about the used platform and environment details.

@NickIliev Hi again. I cloned that app and did
npm i
tns debug android --bundle

the app then started.

I opened main-page.xml and changed the label text from "Tap the button" to "Tap the button!!"
Saved

The CLI then detected the changed, webpack incrementally compiled, then the app did all its hooks, reinstalled the app on the emulator, and opened the app.

The text unfortunately did not change, so my livesync is busted somehow.

Here is my environment:
tns 4.1.2
nativescript 4.1.2
webpack 4.16.1
typescript 2.7.2
nativescript-angular 6.1.0-rc.0
windows 10
android studio emulator latest, api 28

Is there something else that has to be done to get this working? Thanks for the help again!

@IAMtheIAM You are probably hitting this known bug related to API 27 and above. Can you try the same workflow by using a lower API level emulator (e.g API 25).

That's great to know! I downgraded to API 25 and it fixed the issue! thanks once again. Incremental compile and reload takes about 30 seconds - better than 3 minutes for a full build, and better than a clean build which takes almost 10 minutes.

Are there any optimizations that could be done to speed up these incremental compilations, such as multi threaded webpack build (aka HappyPack / Thread-Loader) or gradle builds, to get down to around 2-5 seconds reload time?

@NickIliev is there going to be fix for this issue?
As you know with this goole play do not accept API 25 or lower apps.

Hi @tomylee001001,

Live sync should be ok on all android versions with latest official release.

If you still experience issues, please log an issue and provide as much details as possible.

@tomylee001001 Google Play will continue to accept applications that are working on lower API levels. What the blog says and what Google will require is that the targetSdkVersion should be set to API 26 from the 1st of November. This will not restrict the minSdkVersion or the compileSdkVersion and is not related to what device you will use for development (and respectivly for livesync).

The issue with targetSdkVersion is logged here

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bradmartin picture bradmartin  路  3Comments

DimitarTachev picture DimitarTachev  路  3Comments

leevigraham picture leevigraham  路  3Comments

NickIliev picture NickIliev  路  3Comments

PeterStaev picture PeterStaev  路  3Comments