我想要生成第二个依赖于另一个包的webpack包。每个页面都需要捆绑一个,但只有一些页面需要捆绑两个。如何构建从另一个入口点包导入模块的webpack包?
举例来说,假设我有以下的入口点的脚本(这是简单的例子,只是用它们来获得跨越点):
捆one.js
import $ from 'jquery';
$(document).data('key', 'value');
捆two.js
import $ from 'jquery';
const value = $(document).data('key');
我知道,我可以使用CommonsChunkPlug生成一个包含WebPack加载器和jQuery的commons.js文件,但这需要在每个页面上加载commons.js和bundle-one.js,即使我不需要加载bundle-two.js。
因此,基本上是否有一种方法可以将bundle-one.js构建为所有页面的“主要”JavaScript包,然后通过bundle-two.js设置从bundle-one.js加载jQuery?
可能的解决方案[here](http://stackoverflow.com/questions/30329337/how-to-bundle-vendor-scripts-separately-and-require-them-as-needed-with-webpack?rq=1 ) – highFlyingDodo