Tag Archives: Vue production webpack package PathError

Vue production webpack package PathError [Solved]

Vue version:   “^2.5.2”

Webpack version: ‘^ 3.6.0’

1. Page blank after first packaging   Modify config/index/build/assetspublicpath   Is ‘./’

 1   build: {
 3     index: path.resolve(__dirname, '../dist/index.html'),
 5     // Paths
 6     assetsRoot: path.resolve(__dirname, '../dist'),
 7     assetsSubDirectory: 'static',
 8     assetsPublicPath: './',
 9     .........
10   }

Reason: static is directly used as the direct path during packaging

2. An error is reported again. The page img file introduces an error, which is added under build/utils.JS/

1     if (options.extract) {
2       return ExtractTextPlugin.extract({
3         use: loaders,
4         fallback: 'vue-style-loader',
5         publicPath:"../../"  //  ADD
6       })
7     }

Reason: after packaging, our CSS will be extracted into a separate CSS file. At this time, the relative path relationship between CSS and images will change