Nativescript-cli: Combine JavaScript files in a single file in release builds

Created on 19 May 2015  路  9Comments  路  Source: NativeScript/nativescript-cli

On iPhone 5 about 50ms of 980ms of the startup time of the Cuteness sample (and similar on Android) is spent for requiring JavaScript modules.

This could be reduced if we combine (and optionally minify) all used JavaScript modules in release build.

feature

Most helpful comment

Debugging issues:

Encryption issues:

Other issues:

Running webpack with core NativeScript apps:

All 9 comments

This could be somehow related to the transpilers support #493

Maybe we can work with @mishoo and use the excellent Uglify.js lib?

The problem seems to come from how page.xml code behind is managed.
From my test, it seems page.xml needs page.js (ie page.css) to find methods...

So the limitation is how to tell page.xml where to get navigatedTo for example.
Something like this:
< Page codeFile="path/to/the/bundlefile.js" codeClass="Mynamespace.Myclass" navigatedTo="pageNavigatedTo" />
or:
< Page codeFile="path/to/the/bundlefile.js" navigatedTo="Mynamespace.Myclass.pageNavigatedTo" />

For now, I'm unable to use this kind of folder structure in my app:

  • scripts (all .js files)
  • views (all .xml files)
  • styles (all .css files)

this could solve my problem too.

This can probably negativly reflect on how you debug and/or/when get error reports from production apps

Source Maps, Source Maps everywhere... We need to support these for obfuscators, transpilers etc.
Meanwhile we've spent some time profiling the app and improved our caching.

XML code-behind will be interesting, source maps won't handle that easily. They map the location in the generated JavaScript to the original source, however for the XMLs we will need a mapping that works the other way around.

Further things to research:

  • [ ] Research integration with Core NativeScript apps
  • [ ] HotReload (https://github.com/webpack/docs/wiki/hot-module-replacement-with-webpack)
  • [ ] Debugger integration (including TypeScript and source maps)
  • [ ] Packing and requiring other resources (XML, CSS) from within the bundle
  • [ ] LiveSync - how will it work with the bundle
  • [ ] Encryption - verify the plugin works with the bundler
  • [ ] Android snapshot - how will it work with the bundle and encryption
  • [ ] Android static binding generator - how will it work with the bundle and encryption

Debugging issues:

Encryption issues:

Other issues:

Running webpack with core NativeScript apps:

This should be resolved by nativescript-dev-webpack.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NickIliev picture NickIliev  路  3Comments

trodellez picture trodellez  路  3Comments

Anilinfo2015 picture Anilinfo2015  路  3Comments

ZMW9 picture ZMW9  路  3Comments

NickIliev picture NickIliev  路  3Comments