new HtmlWebpackPlugin({ filename: config.build.index, template: 'index.html', inject: true, minify: { removeComments: true, collapseWhitespace: true, removeAttributeQuotes: true }, chunksSortMode: function (chunk1, chunk2) { var order = ['manifest', 'vendor', 'track', 'app']; // 在此处进行配置文件顺序 var order1 = order.indexOf(chunk1.names[0]); var order2 = order.indexOf(chunk2.names[0]); return order1 - order2; } }),
在webpack.prod.conf.js 中进行配置