building for production...Error processing file: static/css/app.961533fc18508d1a5b4a6edc8cbf30aa.css (node:40432) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 15): TypeError: Cannot read property 'toFixed' of undefined (node:40432) [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. 引入了2.1.3版本,打包的时候报错
[Tencent/weui]引入了2.1.3版本,打包的时候报错
回答
@dantine123 @lqtcts 能否把报错日志整个打出来看看?
ERROR in ./node_modules/weui/dist/style/weui.css
Module build failed: ModuleBuildError: Module build failed: TypeError: Cannot read property 'toFixed' of undefined
at strongRound (F:\tkw-hrc-ued\dlls\node_modules\svgo\plugins\convertPathData.js:766:21)
at F:\tkw-hrc-ued\dlls\node_modules\svgo\plugins\convertPathData.js:424:17
at Array.filter (
ERROR in ./node_modules/css-loader!./node_modules/weui/dist/style/weui.css
Module build failed: TypeError: Cannot read property 'toFixed' of undefined
at strongRound (F:\tkw-hrc-ued\dlls\node_modules\svgo\plugins\convertPathData.js:766:21)
at F:\tkw-hrc-ued\dlls\node_modules\svgo\plugins\convertPathData.js:424:17
at Array.filter (
大佬帮忙看一下@BearJ
@fengyunchangxuan @geekgray 抱歉回复晚了,试试把 svgo 关掉看看?
@lollipop7 在webpack的配置文件里,如果是vue-cli生成的项目,试试这样:
// vue.config.js
module.exports = {
chainWebpack: config => {
config.plugin('optimize-css').tap(([options]) => {
options.cssnanoOptions.preset[1].svgo = false
return [options]
})
}
}
@BearJ vue init生成的项目,后来放弃使用weui了,谢谢回复
ERROR in ./node_modules/weui/dist/style/weui.css Module build failed: ModuleBuildError: Module build failed: TypeError: Cannot read property 'toFixed' of undefined at strongRound (F:\tkw-hrc-ued\dlls\node_modules\svgo\plugins\convertPathData.js:766:21) 看这个错误,很显然是这个包里的文件convertPathData出的问题,一般来说,如果批量引入了,但是又确实没用到,不会配置打包的话,可以直接找到node_modules里去,屏蔽toFixed就可以了。 这种方式也适用于任何此类打包错误,因为一些没用到的内容去试各种打包配置感觉没必要。