vue版本
"vue": "^2.5.2","webpack": "^3.6.0",
問題
打包之後的 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)
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
config/index.js
將文件中的兩個assetsPublicPath: '/'
改爲assetsPublicPath: './'