参考https://webpack.js.org/guides/caching/#deterministic-hashes

var path = require("path");
var webpack = require("webpack");
var ChunkManifestPlugin = require("chunk-manifest-webpack-plugin");
var WebpackChunkHash = require("webpack-chunk-hash");

module.exports = {
  entry: {
    vendor: "./src/vendor.js", // vendor reference file(s)
    main: "./src/index.js" // application code
  },
  output: {
    path: path.join(__dirname, "build"),
    filename: "[name].[chunkhash].js",
    chunkFilename: "[name].[chunkhash].js"
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      name: ["vendor", "manifest"], // vendor libs + extracted manifest
      minChunks: Infinity,
    }),
    new webpack.HashedModuleIdsPlugin(),
    new WebpackChunkHash(),
    new ChunkManifestPlugin({
      filename: "chunk-manifest.json",
      manifestVariable: "webpackManifest",
      inlineManifest: true
    })
  ]
};

相关文章:

  • 2022-12-23
  • 2021-07-10
  • 2022-02-18
  • 2022-12-23
  • 2021-06-29
  • 2022-02-02
  • 2021-05-20
  • 2022-12-23
猜你喜欢
  • 2021-12-19
  • 2021-12-28
  • 2021-06-17
  • 2022-02-13
  • 2021-12-09
  • 2022-12-23
  • 2021-09-05
相关资源
相似解决方案