最近升级vue-cli3.0 打包时发现 css比以前多出了好多文件,细看后发现每个.vue文件都打包出一个css了,并且只要.vue文件内有style标签,即使没有css也会打包出一个空的css,以前打包后就一个css

下面是我的配置文件 vue.config.js
module.exports = {
pages: {
index: {
// 入口js的路径
entry: './src/main.js',
// 页面模板路径
template: './public/index.html'
},
test: {
// 入口js的路径
entry: './src/test/main.js',
// 页面模板路径
template: './public/test.html'
}
},
// css: {
// // extract: false
// },
devServer: {
// port: 9526, // 端口号
// host: 'localhost',
https: false, // https:{type:Boolean}
open: true, // 配置自动启动浏览器
// proxy: 'http://localhost:4000' // 配置跨域处理,只有一个代理
proxy: {
'/api': {
target: ' http://192.168.10.44:7300/mock/5b7172e53e69ed21b4690861/api',
changeOrigin: true,
pathRewrite: {
'^/api': '' // 需要rewrite重写的,
}
}
} // 配置多个代理
}
}
显然楼上的大哥们都不知道在说啥,config.plugins.delete('prefetch'),移除Prefetch就可以了,不过其实只是为所有js和css进行了一个预加载,不影响页面