我在我的一个项目中遇到了DllReferencePlugin的问题(我使用Webpack 1.13.2)。特别是,我有3对由DllPlugin生成的清单和包文件,在主包的插件部分中有3个DllReferencePlugin部分:
entry: {
body: [
'./src/main.js',
],
},
...
plugins: [
...
new webpack.DllReferencePlugin({
context: process.cwd(),
manifest: path.join(dllPath, 'commons-manifest.json'),
}),
new webpack.DllReferencePlugin({
context: process.cwd(),
manifest: path.join(dllPath, 'vendor-manifest.json'),
}),
new webpack.DllReferencePlugin({
context: process.cwd(),
manifest: path.join(dllPath, 'react-manifest.json'),
}),
]
...当我试图运行它时,我会得到以下错误:
/node_modules/webpack/lib/DelegatedModuleFactoryPlugin.js:43 if(this.options.content中的请求&请求){^ TypeError:无法使用“in”运算符搜索未定义的./src/main.js
相同的配置对我的另一个项目很好,所以我认为这个错误与路径解析有关。我尝试过上下文和显式路径的相对路径,但它也不起作用。
发布于 2017-02-26 15:41:22
问题是,对于Webpack的这个版本(1.13.2),应该使用manifest: require(path.join(dllPath, 'commons-manifest.json'))而不是manifest: path.join(dllPath, 'commons-manifest.json')
https://stackoverflow.com/questions/42466844
复制相似问题