Angular 2/4: difference between scripts.bundle.js and vendor.bundle.js

Angular 4: after running the command: ng buildI have this structure

0.chunk.js      favicon.ico           polyfills.bundle.js.map
0.chunk.js.map  index.html            scripts.bundle.js
1.chunk.js      inline.bundle.js      scripts.bundle.js.map
1.chunk.js.map  inline.bundle.js.map  styles.bundle.js
2.chunk.js      main.bundle.js        styles.bundle.js.map
2.chunk.js.map  main.bundle.js.map    vendor.bundle.js
assets          polyfills.bundle.js   vendor.bundle.js.map

What is the difference between scripts.bundle.jsand vendor.bundle.js?

I believe that the difference is that it scripts.bundle.jscontains all the external files .js, but it vendor.bundle.jscontains all the created modules.

EDIT

but I can import files .jsfrom node_modulesto vendor.bundle.jsand scripts.bundle.js. What is the best approach: importing files .jsinto modules or adding them to an object.angular-cli.json scripts

~ Thanks so much for the help!

+4
source share
1 answer

scripts.bundle.js scripts, .angular-cli.json
vendor.bundle.js npm modules, app.module.

, , - webpack-bundle-analyzer

"analyze": "ng build --prod --stats-json && webpack-bundle-analyzer dist/stats.json", package.json npm install webpack-bundle-analyzer npm run analyze

scripts .angular-cli.json - , , . , - npm module. npm vendor.bundle.js, .

https://github.com/angular/angular-cli/wiki/stories-global-scripts

+4

Source: https://habr.com/ru/post/1686321/


All Articles