vue打包空白及字体路径错误问题

vue项目打包后空白

在config/index.js文件中 assetsPublicPath: '/', 改为 assetsPublicPath: './',  

build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),

// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',   //在这里将''改成 './'

/**
* Source Maps
*/

productionSourceMap: true,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',

 

 

vue项目打包后背景图路径多了/css/static

在build/utils.js文件中添加publicPath:'../../'

if (options.extract) {
    return ExtractTextPlugin.extract({
        use: loaders,
        fallback: 'vue-style-loader',
        publicPath: '../../'
    })
} else {
posted @ 2019-09-11 09:25  不不abc  Views(673)  Comments(0Edit  收藏  举报