entry: {
main: './src/main.js',
core: [
'react',
'react-dom',
'redux',
'react-redux',
'redux-saga',
'isomorphic-fetch',
],
ui: [
'antd'
]
}
entry如上,因为 antd 包较大,打算分成两个包,但是 antd 打包后引入了 react 库,这样就重复了
可以一个个来打包,先用 webpack DllPlugin 做一个 react 的 dll 打包文件。再用 webpack DllPlugin 打包 antd,这时要用 DllReferencePlugin 引用前面的 react 打包文件。最后应用程序在引用 react 和 antd 的打包文件。
PS:DllPlugin 提取第三方模块不够完整,我一般用于开发环境加速构建,生产环境可以考虑使用 CommonsChunkPlugin 来划分第三方库。类似问题见 https://segmentfault.com/q/10...