编辑 /vue.config.js
为了提高单页打开速度、分文件打包 dist js
module.exports = {...configureWebpack: (config) => {if (process.env.NODE_ENV === "production") {// 开启分离jsconfig.optimization = {runtimeChunk: "single",splitChunks: {chunks: "all",maxInitialRequests: Infinity,minSize: 20000,cacheGroups: {vendor: {test: /[\\/]node_modules[\\/]/,name(module) {// get the name. E.g. node_modules/packageName/not/this/part.js// or node_modules/packageNameconst packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];// npm package names are URL-safe, but some servers don't like @ symbolsreturn `npm.${packageName.replace("@", "")}`;},},},},};// end}},
