-1

I try to upgrade a old grunt webpack based builder (been using since Angular 2 to 7), but now with Angular 8, I cannot upgrade to Ivy.

I have only a cryptic error:

ERROR in bundle.4c959b202dbdca8012b0.js from UglifyJs
Unexpected token: keyword «const» [./node_modules/@angular/forms/__ivy_ngcc__/fesm5/forms.js:29,0][bundle.4c959b202dbdca8012b0.js:69647,0]

My tsconfig.aot.json looks like this:

{
  "compilerOptions": {
    "skipLibCheck": true,
    "outDir": "build/aot",
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "lib": [
      "es5",
      "es6",
      "dom",
      "es2015.collection",
      "es2015.promise",
      "es2015.core",
      "es2016",
      "es2017"
    ]
  },
  "include": [
    "src/angular/**/*",
    "test/angular-webpack/**/*"
  ],
  "exclude": [
    "node_modules",
    "src/angular/bundle.ts",
    "test/angular-webpack/angular/bundle.ts",
    "test/angular-karma",
    "build/browser"
  ],
  "angularCompilerOptions": {
    "enableIvy": true,
    "annotationsAs": "decorators",
    "preserveWhitespaces": false
  }
}
Patrik Laszlo
  • 3,813
  • 7
  • 17
  • 32
  • Possible duplicate of [UglifyJS throws unexpected token: keyword (const) with node\_modules](https://stackoverflow.com/questions/47439067/uglifyjs-throws-unexpected-token-keyword-const-with-node-modules) – Sachila Ranawaka May 29 '19 at 13:01
  • 1
    "i am not using uglifyjs at all" --- uhh clearly one of your packages is?? otherwise where is this uglifyjs error coming from?? – Cody G May 29 '19 at 14:16
  • `ERROR in bundle.4c959b202dbdca8012b0.js from UglifyJs ....` <= That message clearly states that uglifyjs is throwing the error. – Igor May 29 '19 at 14:24

1 Answers1

-1

actually, it was my problem, i switched to terser-webpack-plugin and now it works.

Patrik Laszlo
  • 3,813
  • 7
  • 17
  • 32