multiple dll packages are generated, it will cause duplicate references
I am using the autodll-webpack-plugin procedure and found that if multiple dll packages are generated, it will cause duplicate references.

// file: webpack.dll.conf.js
entry: {
vendor_react: ["react", "react-dom"],
vendor_third_party: [
"axios",
"moment",
"mobx",
"mobx-react",
"react-router-dom",
"rxjs"
]
},
// optimization: {
// splitChunks: {
// chunks: "all",
// }
// },
After analyzing with webpack-bundle-analyzer, it was found that react-dom was repeated, as shown below:

chunks:all

// file: webpack.dll.conf.js
entry: {
vendor_react: ["react", "react-dom"],
vendor_third_party: [
"axios",
"moment",
"mobx",
"mobx-react",
"react-router-dom",
"rxjs"
]
},
optimization: {
splitChunks: {
chunks: "all",
}
},
After analysis, there is only one react-dom, as shown below:

Use AutoDllPlugin to get the following result:
// webpack.common.js
new AutoDllPlugin({
inject: true, // will inject the DLL bundles to index.html
debug: false,
context: __dirname,
filename: "[name]_[hash:6].js",
path: "./dll",
entry: {
vendor: ["react", "react-dom"],
vendor_libs: [
"axios",
"moment",
"mobx",
"mobx-react",
"react-router-dom",
"rxjs"
]
}
}),

Ps1:
- I can't analyze the generated
dllfile usingwebpack-bundle-analyzer - The generated
vendor_libsis similar in size to thechunks:allpackage, and even larger.
Ps2:
- Isn't my approach wrong,
dlldoes not actually need to distinguish between multiple packages - I tried to handle
dllmyself, but afterchunk:all, an exception will occur, making it unusable.
Can you answer my doubts? Thank you.
This article may answer you: http://www.programmersought.com/article/1319630786/
@g8up Thank you very much for your answer. The method of this article is correct
But we hope that autodll webpack plugin can provide this function
Or is it correct to generate only one DLL?