Make the installed size of the package smaller #685
Description
Problem
The plugin depends on packages that are not required for all project flavors. For example - @angular-devkit/core
is necessary only for the Angular projects.
Possible solutions
-
Split the nativescript-dev-webpack package to four different flavors - Vue, Angular, JS, TS, core stuff.
Pros: Minimal dependencies for each flavor. Easier deps management in projects.
Cons: Hard to maintain. How to migrate existing project. -
Add the Angular dependencies to the project's package.json.
Pros: Minimal deps for the other flavors.
Cons: Hard to update the project's package.json on new versions. -
Add the deps for each flavor when installing the plugin.
Pros: Minimal deps for each flavor.
Cons: Hard to update the project's package.json on new versions. -
Integrate required tooling in CLI and remove webpack from all templates. This way you'll install CLI once and you'll get the tooling you need. We can make the check smarter - in case the required tooling is already available in the project (as devDependency) - use it, in case not - fallback to CLI dependencies.
Pros: You will have only one instance of the webpack plugin, which is globally installed.
Cons:- nativescript-dev-webpack heavily depends on the versions of the project dependencies (tns-core-modules, nativescript-angular and especially angular/*). Making it global as a dependency of the {N} CLI, will complicate building and updating the projects.
- webpack uses a webpack.config.js file when building. Currently, that file is added when installing nativescript-dev-webpack to your project. If we make the plugin global, we'll have to add the configuration file to all templates. This may complicate the maintenance of the templates because we'll have to release them every time we release the nativescript-dev-webpack plugin.
- the webpack.config.js file is also heavy coupled to the versions of nativescript-dev-webpack, angular/*, etc. We will have to come up with an updating strategy for it. Currently, that's handled by an updated script distributed with the nativescript-dev-webpack plugin.