配置共分为两个步骤:
第一步:修改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对象下的数据
第二步:修改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)
}