2022-03-31 Failed to minify the code from this file
前言:项目打包报错。
报错内容:
1 Creating an optimized production build... 2 Failed to compile. 3 4 Failed to minify the code from this file: 5 6 ./node_modules/_asn1.js@5.4.1@asn1.js/lib/asn1/base/node.js:283 7 8 Read more here: http://bit.ly/2tRViJ9 9 10 npm ERR! code ELIFECYCLE 11 npm ERR! errno 1 12 npm ERR! ltjyd@0.1.0 build: `node scripts/build.js` 13 npm ERR! Exit status 1 14 npm ERR! 15 npm ERR! Failed at the ltjyd@0.1.0 build script. 16 npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 17 18 npm ERR! A complete log of this run can be found in: 19 npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2022-03-31T08_22_24_542Z-debug.log
解决方案:
关键内容:
Failed to minify the code from this file: ./node_modules/_asn1.js@5.4.1@asn1.js/lib/asn1/base/node.js:283
翻译:未能缩小此文件【./node_modules/_asn1.js@5.4.1@asn1.js/lib/asn1/base/node.js:283】中的代码
原因:该文件里的代码无法被打包,定位到该行代码: 【let result = state['default'];】
解决方案:把let改为var。
结束语:
不要问我为什么,我也是找了篇文章看了才解决的,后续打包也是遇到这个问题,我依旧把let改成var就行了。
据原文作者说是es6转不了es5,也许就是这个原因吧。
原文在这:https://blog.csdn.net/u010391930/article/details/118188243
额嗯呃emmmm,其实,额,怎么说呢。
在我快写完这个日志的时候,我同事告诉我,这个项目其实已经打包成功了。也就是说,可以不用理会这种报错。。。
emmm...

浙公网安备 33010602011771号