vue-cli打包之后无法运行index.html

webpack 4

打包之后的 dist 文件下面包含 static 文件和 index.html 文件,直接打开index.html文件为空白,控制台会有很多文件路径错误

解决:

build/util.js:

   if (options.extract) {
      return ExtractTextPlugin.extract({
        use: loaders,
        publicPath:'../../',   //添加这句
        fallback: 'vue-style-loader'
      })
    } else {
      return ['vue-style-loader'].concat(loaders)
    }

config/index.js

将文件中的两个中的一个build下面的 assetsPublicPath: '/' 改成 './'

 

你可能感兴趣的:(less/sass)