Webpack is also highly configurable and extensible - you can customize every step of the bundling process and add support for all sorts of asset generation and manipulation procedures, for example - code minification.
Since every project is unique and can have quite complex requirements for bundling we tried to make webpack configuration as simple as possible. After installation, the plugin will configure the bundling dependencies, and add a basic configuration that should work for most projects. Developers can (and should) extend that to fit their specific project needs.
To enable the webpack option for your application, you need to install the latest version of the nativescript-dev-webpack plugin as a
devDependency. How to install a plugin as a
devDependency is explained in Plugins Management.
To enable webpack builds for apps originally created with NativeScript Sidekick 1.1.1 or older versions, you need to make additional modifications. For more information, see the NativeScript Webpack — What Changed and How to Upgrade blog post.
After you enable the webpack option, click on the blue cogwheel icon next to it to open the webpack configuration dialog. Here, you can enable or disable several predefined settings or add custom webpack settings.
This option is useful only for Android builds and will significantly increase the start up time of the application. When you build your Android app with Snapshot enabled, a single webpack bundle will be loaded in an empty V8 context (snapshotted context) and after its execution captures a snapshot of the produced V8 heap, it will save it in a blob file. Then, the blob file is included in the
APKbundle and it is loaded by the Android Runtime on app initialization. This will remove the need for loading, parsing and executing the script on app start up and result in increased performance.
AOT (Ahead-of-Time Compilation)
Custom webpack settings
In this field, you can provide various custom webpack settings in