Angular 9 build Generating ES5 bundles for differential loading... An unhandled exception occurred :

Found the solution for the above issue. steps to fix 1. run npm outdated. 2. from the list of packages update the packages in red color to wanted version.

enter image description here


Temporary solution: There was a change in @angular-devkit/build-angular which updated the differential loading. To fix this in your Angular project, change the target value from “es2015” to “es5” in your tsconfig.json:

    {
      "compileOnSave": false,
      "compilerOptions": {
        "baseUrl": "./",
        "outDir": "./dist/out-tsc",
        "sourceMap": true,
        "declaration": false,
        "module": "esnext",
        "moduleResolution": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "importHelpers": true,
        "target": "es5",
        "typeRoots": [
          "node_modules/@types"
        ],
        "lib": [
          "es2018",
          "dom"
        ]
      }
    }


I was facing the same problem and resolved by removing a package that uses svg.js@2.7.1 !!! From what you discover, this error is caused by the discontinued version of svg.js@2.7.1 !!! Look inside your application that there is a package using this and remove it!

(NOTE: Sorry for possible errors in my writing, I'm Brazilian, I'm having to use Google translator to write this)

Tags:

Angular