vue build 报错 Error: CSS minifica

2022-07-29  本文已影响0人  3e2235c61b99

我司一个项目开发阶段启动没有问题,但是开发完打包时报错如下:

 ERROR  Error: CSS minification error: Expected a pseudo-class or pseudo-element.. File: static/css/chunk-54dad19c.4031b68b.css
Error: CSS minification error: Expected a pseudo-class or pseudo-element.. File: static/css/chunk-54dad19c.4031b68b.css
    at D:\work\nia-nation\nia-front\node_modules\@intervolga\optimize-cssnano-plugin\index.js:106:21
    at async Promise.all (index 22)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-element-admin@4.2.1 build:prod: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-element-admin@4.2.1 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\admin\AppData\Roaming\npm-cache\_logs\2022-07-29T02_56_54_631Z-debug.log

解决办法:
删除vue-cli 自带的压缩 plugin:OptimizeCssnanoPlugin

// vue.config.js 
config.plugins.delete('optimize-css')

参考自

上一篇下一篇

猜你喜欢

热点阅读