[英]Can webpack bundle different versions of the same dependency
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 小部件A
widget B 小部件B
bundle 束
So I found that NPM provides a way to alias the names of modules/libraries upon installation. 因此,我发现NPM提供了一种在安装时对模块/库名称进行别名的方法。 I tested this and it works great, and the 2 versions of jQuery are even bundled in the same vendors.bundle by Webpack.
我对此进行了测试,并且效果很好,并且jQuery的2个版本甚至都捆绑在了Webpack的同一vendor.bundle中。 Here's the module alias syntax:
这是模块别名语法:
npm install jquery2@npm:jquery@2
npm install jquery3@npm:jquery@3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.