Error In Runtime From Terser During Build –prod

Issue

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  

Solution

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",

Answered By – Pietro Saccardi

Answer Checked By – Cary Denson (AngularFixing Admin)

Leave a Reply

Your email address will not be published.