【发布时间】:2017-04-18 15:35:27
【问题描述】:
我正在尝试按照 react-boilerplate 和 this one 等指南将一堆库放在 DLL 上。
当我构建和运行时,DLL 文件未定义。 我可能遗漏了一些我做了一个单独的 webpack 来构建 dll 的东西:
import webpack from 'webpack'
const library = '[name]'
export default {
entry: {
'lokka': ['lokka', 'lokka-transport-http', 'socket.io-client']
/** Other libs **/
},
output: {
filename: '[name].dll.js',
path: 'build/',
library: library
},
plugins: [
new webpack.DllPlugin({
path: 'build/[name]-manifest.json',
name: library
})
]
}
并添加了对 manifest.json 的引用
import webpack from 'webpack'
const desiredLibs = [
'lokka'
]
const plugins = desiredLibs.map((lib) => {
return new webpack.DllReferencePlugin({
context: process.cwd(),
manifest: require(`../build/${lib}-manifest.json`)
})
})
export const dllReference = () => {
return { plugins }
}
export default dllReference
还有什么我应该做的吗?
就我而言,它抱怨在运行代码时找不到 lokka。
【问题讨论】:
标签: node.js dll webpack webpack-dev-server