I've a project made of different widgets that all share the same vendor. I would like to know if I could bundle different versions of the same vendor library:
widget A
widget B
bundle
When webpack processes your application, it internally builds a dependency graph from one or more entry points and then combines every module your project needs into one or more bundles, which are static assets to serve your content from.
A dependency is a code that your package needs to run. Dependencies are managed by two files. The DESCRIPTION manages dependencies at the package level; i.e. what packages needs to be installed for your package to work.
Webpack is a build tool to manage your dependencies (css, js, etc.).
Webpack allows you to define externals - modules that should not be bundled. When bundling with Webpack for the backend - you usually don't want to bundle its node_modules dependencies. This library creates an externals function that ignores node_modules when bundling in Webpack.
So I found that NPM provides a way to alias the names of modules/libraries upon installation. I tested this and it works great, and the 2 versions of jQuery are even bundled in the same vendors.bundle by Webpack. Here's the module alias syntax:
npm install jquery2@npm:jquery@2
npm install jquery3@npm:jquery@3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With