vue build 报错 Error: CSS minification error: Expected a pseudo-class or pseudo-element

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

 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! [email protected] build:prod: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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')

参考自

你可能感兴趣的:(vue build 报错 Error: CSS minification error: Expected a pseudo-class or pseudo-element)