输出
output: {
path: config.build.assetsRoot,
publicPath: process.env.NODE_ENV === 'production' ?
config.build.assetsPublicPath : config.dev.assetsPublicPath,
filename: '[name].js'
}
根据
build: {
env: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
productionSourceMap: false,
productionGzip: false,
productionGzipExtensions: ['js', 'css']
},
构建后,索引页面正常工作,css背景图像路径是这样的
background: url(./static/img/bg_certificate.c5cad1e.png) no-repeat 50%;
但是组件css背景图片路径错误,像这样
background: url(static/img/btn_my.b9186cc.png) no-repeat 50%;
看起来路径丢失了“./”,