vue打包--error:enoent:no such file or directory,open....报-4058问题

 问题描述:没有此类文件或文件已经损坏

问题产生原因:没有生成相应的hash值,我的webpack配置有问题,问题就出在ExtractTextPlugin这里

问题解决过程:npm run build 完后,报以上错误,查看了dist文件目录,点开css文件目录里面没有生成相应的 .css文件,css文件目录下为空

 问题解决:修改为以下代码,就解决了

new ExtractTextPlugin({
      filename: utils.assetsPath('css/[name].[chunkhash].css'),
      // Setting the following option to `false` will not extract CSS from codesplit chunks.
      // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
      // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
      // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
      allChunks: true,
    }),

猜你喜欢

转载自blog.csdn.net/qq_35353972/article/details/129907102