Repeated references to react after webpack react is packaged with dll causes the bundle to be too large

use webpack dll to package dependent packages and put react into the module packaged by dll.
when the packaging is complete, the app.bundle.js still contains the source code of react. Could you tell me what to do with the change?

webpack.dll.js

module.exports = {
  entry: {
    polyfill: ["babel-polyfill", "whatwg-fetch", "es6-promise"],
    common: ["history", "md5", "object-path", "lokijs", "object-assign", "classnames"],
    react: ["react", "react-dom"],
    reactRedux: ["react-redux", "redux", "redux-observable"],
    reactRouter: ["react-router-dom", "react-router-redux"]
  },
  output: {
    path: path.join(__dirname, buildDir),
    filename: "[name].dll.js",
    library: "[name]_[hash]"
  },
  context: path.resolve(__dirname),
  mode: NODE_ENV,
  devtool: "source-map",
  plugins: [
    new CleanWebpackPlugin([buildDir]),
    new webpack.DefinePlugin({
      "process.env.NODE_ENV": JSON.stringify(NODE_ENV)
    }),
    new webpack.DllPlugin({
      path: path.join(__dirname, buildDir, "[name].manifest.json"),
      name: "[name]_[hash]",
      context: __dirname
    })
  ]
};

Why not use create-react-app scaffolding to package


if you use dll package, don't use CommonsChunkPlugin to package react

Menu