vue 项目打包之后 修改配置文件
作者:chrispy
1.1.12
路径
assetsPublicPath: '/', ===> assetsPublicPath: './',
productionSourceMap: true, ===> productionSourceMap: false,
productionGzip: false, ===> productionGzip: true, // 每个文件对一个压缩包
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath ====> ? './' + config.build.assetsPublicPath
: config.dev.assetsPublicPath ====> : './' + config.dev.assetsPublicPath
},
3.0.0
config/index.js
assetsPublicPath: '/', ===> assetsPublicPath: './',
productionSourceMap: true, ===> productionSourceMap: false,
css 引用图片路径
build/utils.js
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader',
publicPath: '../../' // <-- 增加
})
} else {
return ['vue-style-loader'].concat(loaders)
}