NativeScript / nativescript-dev-webpack

A package to help with webpacking NativeScript apps.
Apache License 2.0
97 stars 49 forks source link

move share.module in vendor.js #1074

Closed bagnos closed 4 years ago

bagnos commented 4 years ago

Hi,

I'm using the latest version of nativescript-dev-webpack, I see that the plugin imported are now moved automatically in vendor.js . There's non need to create src/vendor.ts and put the import in it. I have a Module shared between the feature modules, how can I move it to vendor.js? I tried to create the src/vendor.ts but by webpack analyzer I keep seeing them in the feature modules.

Can you help me?

Fatme commented 4 years ago

@bagnos,

The bundle.js and vendor.js files inside platforms directory are automatically generated files by webpack compilation. All modules from application are produced in bundle.js file and all modules from node_modules e.g all dependencies of the application are outputted in vendor.js.

I have a Module shared between the feature modules, how can I move it to vendor.js?

Why do you need to move the module to vendor.js? Can you give us more details about your particular use case?

bagnos commented 4 years ago

hi,

the shared module is imported in all of the feature modules, so in the chunks I can see that module many times, see below. If I could move it to vendor.js I improved size e boot time (snapshot) I see that in this old link https://www.youtube.com/watch?v=7rHnLb-2tZ4.

[image: image.png]

On Tue, Oct 22, 2019 at 2:37 PM Fatme notifications@github.com wrote:

@bagnos https://github.com/bagnos,

The bundle.js and vendor.js files inside platforms directory are automatically generated files by webpack compilation. All modules from application are produced in bundle.js file and all modules from node_modules e.g all dependencies of the application are outputted in vendor.js.

I have a Module shared between the feature modules, how can I move it to vendor.js?

Why do you need to move the module to vendor.js? Can you give us more details about your particular use case?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/NativeScript/nativescript-dev-webpack/issues/1074?email_source=notifications&email_token=ABQFBKQ4DEREIB4UEAIBUADQP3XYVA5CNFSM4JDOMBEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB5SK3Q#issuecomment-544941422, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQFBKQDT4JQMMD3774DS7DQP3XYVANCNFSM4JDOMBEA .

edusperoni commented 4 years ago

You can change this in your webpack.config.json (https://github.com/NativeScript/nativescript-dev-webpack/blob/master/demo/AngularApp/webpack.config.js#L169). If that test returns true for your file it gets bundled in vendor.js

bagnos commented 4 years ago

Thanks so much @edusperoni !

It works.