rangle / rangle-starter

48 stars 23 forks source link

Move vendor manifest out of webpack.config #187

Closed smithad15 closed 8 years ago

smithad15 commented 8 years ago

For the angular2-starter it might be easier for project maintenance to create a vendor manifest file like src/vendor.ts with import statements instead of keeping an array inside of webpack.config. Then you don't have to touch the webpack file during the usual course of production.

Might be interesting to see if there was a way to add a postinstall hook to dynamically inject an import statement into that file for any new dependencies that are added. Would help with the problem of vendor package code leaking into the app bundle.

troyt-42 commented 8 years ago

@smithad15 I have moved the vendor array from webpack config to src/vendor.ts, and for the postinstall script that automatically inject new packages to src/vendor.ts, I think it is not a suitable thing to do because:

  1. How to identify which new package should be included (what if I installed a new webpack plugin)?
  2. How to (or Should we) remove the old packages if user deleted them in the package.json (accidentally or in purpose)?
smithad15 commented 8 years ago

Agreed on the postinstall script. This should probably be left to the developer.