Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
869 views
in Technique[技术] by (71.8m points)

angular - Error In Runtime From Terser During Build --prod

I have updated everything Angular and am now getting the error below (4x) when I
"Build --prod"

No errors if I remove --prod

I have no real code in this app. It is just a starter shell.

Any suggestions on what to look into?

ERROR in runtime.82c6613acef8f7246fe8.js from Terser
TypeError: Cannot read property 'minify' of undefined
    at minify (/Users/puser/Dropbox/AngularApps/GenesisFYI-v06/node_modules/terser-webpack-plugin/dist/minify.js:175:23)
    at module.exports (/Users/puser/Dropbox/AngularApps/GenesisFYI-v06/node_modules/terser-webpack-plugin/dist/worker.js:13:40)
    at handle (/Users/puser/Dropbox/AngularApps/GenesisFYI-v06/node_modules/worker-farm/lib/child/index.js:44:8)
    at process.<anonymous> (/Users/puser/Dropbox/AngularApps/GenesisFYI-v06/node_modules/worker-farm/lib/child/index.js:51:3)
    at process.emit (events.js:197:13)
    at emit (internal/child_process.js:828:12)
    at processTicksAndRejections (internal/process/next_tick.js:76:17)

My current Version

Angular CLI: 7.3.0  
Node: 11.8.0  
OS: darwin x64  
Angular: 7.2.3  
... animations, common, compiler, compiler-cli, core, forms  
... http, language-service, platform-browser  
... platform-browser-dynamic, router, service-worker  

Package                           Version  
-----------------------------------------------------------  
@angular-devkit/architect         0.13.0  
@angular-devkit/build-angular     0.13.0  
@angular-devkit/build-optimizer   0.13.0  
@angular-devkit/build-webpack     0.13.0  
@angular-devkit/core              0.6.8  
@angular-devkit/schematics        0.6.8  
@angular/cli                      7.3.0  
@angular/pwa                      0.6.8  
@ngtools/webpack                  7.3.0  
@schematics/angular               0.6.8  
@schematics/update                0.13.0  
rxjs                              6.4.0  
typescript                        3.2.4  
webpack                           4.29.0  
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It seems to be a problem with the recently released version 3.16 of Terser, here's the related issue in Terser and in Terser as a Webpack plugin.

In this VueJS issue they recommended to downgrade it to version 3.14.1. You can do it looking for the line in package.json containing "terser" and pin it as follows:

    "terser": "3.14.1",

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...