小编Dar*_*141的帖子

Webpack 4+ 配置

尝试创建迁移指南中建议的 commonsChunkPlugin 翻译。

我从 vue-cli 生成的块中得到了这个:

plugins: [ new webpack.optimize.CommonsChunkPlugin({
  name: 'vendor',
  minChunks (module) {
    // any required modules inside node_modules are extracted to vendor
    return (
      module.resource &&
      /\.js$/.test(module.resource) &&
      module.resource.indexOf(
        path.join(__dirname, '../node_modules')
      ) === 0
    )
  }
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
  name: 'manifest',
  minChunks: Infinity
}),
// This instance extracts shared chunks from …
Run Code Online (Sandbox Code Playgroud)

vue.js webpack-4

6
推荐指数
1
解决办法
884
查看次数

标签 统计

vue.js ×1

webpack-4 ×1