配置共分為兩個步驟:
第一步:修改config/index.js下的配置
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './' // 將'/'修改為'./'
},
注意:修改的build對象下的數(shù)據(jù)
第二步:修改build/utils.js下的配置
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader',
publicPath: '../../' // 添加的字段
})
} else {
return ['vue-style-loader'].concat(loaders)
}