项目部署后,发现浏览器控制台里报错:
static/css/static/fonts/element-icons.535877f.woff net::ERR_ABORTED 404
很明显是打包后文件路径出了问题
解决办法:出处
修改build/utils.js
// (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)
}
如果还是有问题,那就再修改config/index.js
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './' //**修改这里,加个点**
}