报错如下
\ building for production...Error processing file: static/css/app.e8b75d3d19abc5bbbd9bd916f459f0d0.css
(node:16424) UnhandledPromiseRejectionWarning: CssSyntaxError: E:\simou\static\css\app.e8b75d3d19abc5bbbd9bd916f459f0d0.css:1995:6: Unknown word
at Input.error (E:\simou\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\input.js:130:16)
at Parser.unknownWord (E:\simou\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parser.js:563:22)
at Parser.decl (E:\simou\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parser.js:235:16)
at Parser.other (E:\simou\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parser.js:133:18)
at Parser.parse (E:\simou\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parser.js:77:16)
at parse (E:\simou\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\parse.js:17:12)
at new LazyResult (E:\simou\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\lazy-result.js:60:16)
at Processor.
at Processor.process (E:\simou\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\processor.js:117:23)
at Function.creator.process (E:\simou\node_modules\optimize-css-assets-webpack-plugin\node_modules\postcss\lib\postcss.js:148:43)
at OptimizeCssAssetsPlugin.processCss (E:\simou\node_modules\optimize-css-assets-webpack-plugin\index.js:63:19)
at Object.processor (E:\simou\node_modules\optimize-css-assets-webpack-plugin\index.js:29:23)
at E:\simou\node_modules\last-call-webpack-plugin\index.js:139:8
at arrayEach (E:\simou\node_modules\lodash\_arrayEach.js:15:9)
at forEach (E:\simou\node_modules\lodash\forEach.js:38:10)
at LastCallWebpackPlugin.process (E:\simou\node_modules\last-call-webpack-plugin\index.js:136:3)
(node:16424) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:16424) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
首先想到的是插件不兼容 因为项目需求需要使用海康威视的插件;
想到就干,在index.html和main.js中注释掉相关插件继续打包,并没有得到解决;
后面继续查看错误报告,指出都是生成css与js的问题,那么排查的方向就转向webpack;
最后在webpack.prod.conf.js中注释了:
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
应该是压缩提取出的css和js,重复压缩???还是多个文件压缩到同一文件???/
不太清楚,记录下来,哪位大神看到希望给些意见