question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@ngtools/webpack above 1.8.0 is not working because of removing the decorators

See original GitHub issue

Versions

Not using ng, just using @ngtools/webpack with webpack.

Repro steps

tsconfig.aot.json

{
  "compilerOptions": {
    "skipLibCheck": true,
    "outDir": "build/aot",
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true,
    "lib": [
      "es5",
      "es6",
      "dom",
      "es2015.collection",
      "es2015.promise",
      "es2015.core",
      "es2016",
      "es2017"
    ]
  },
  "includes": [
    "src/angular/**/*",
    "test/angular-webpack/**/*"
  ],
  "exclude": [
    "node_modules",
    "src/angular/boot.ts",
    "test/angular-webpack/angular/boot.ts",
    "build/browser"
  ],
  "angularCompilerOptions": {
    "annotationsAs": "decorators",
    "preserveWhitespaces": false
  }
}

Observed behavior

ERROR in Error: TypeError: Cannot read property 'getTsProgram' of undefined
  at AngularCompilerPlugin._getTsProgram (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:186:62)
  at getTypeChecker (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:487:43)
  at ast_helpers_1.collectDeepNodes.filter (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/@ngtools/webpack/src/transformers/remove_decorators.js:14:60)
  at Array.filter (<anonymous>:null:null)
  at standardTransform (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/@ngtools/webpack/src/transformers/remove_decorators.js:14:14)
  at transformer (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/@ngtools/webpack/src/transformers/make_transform.js:14:25)
  at /home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:2492:86
  at reduceLeft (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:2188:30)
  at /home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:2492:42
  at transformRoot (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:63602:82)
  at Object.map (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:1696:29)
  at Object.transformNodes (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:63590:30)
  at Object.emitFiles (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:66273:28)
  at emitWorker (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:69725:33)
  at /home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:69687:66
  at runWithCancellationToken (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:69779:24)
  at Object.emit (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/typescript/lib/typescript.js:69687:20)
  at defaultEmitCallback (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/@angular/compiler-cli/src/transformers/program.js:33:20)
  at AngularCompilerProgram.emit (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/@angular/compiler-cli/src/transformers/program.js:242:30)
  at AngularCompilerPlugin._emit (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:717:49)
  at Promise.resolve.then.then.then (/home/patrikx3/Projects/patrikx3/corifeus/corifeus-web/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:553:54)
  at <anonymous>:null:null
  at process._tickCallback (internal/process/next_tick.js:188:7)

Desired behavior

With Angular 5.0.1 it was working.

Mention any other details that might be useful (optional)

Is @ngtools/webpack behind with Angular 5.0.2 ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:26 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
danieledscommented, Dec 10, 2017

Still same error on 1.9.0

1reaction
getsafcommented, Feb 10, 2018

@p3x-robot I mean template type-safety checks aren’t run so any template errors aren’t caught during the build.

I do see the decorators and inlined html/scss in the output when I turn the flag off. I’m working in a rather large project with multiple teams so type checking the templates is necessary. I need a fix for this soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - @ngtools/webpack above 1.8.0 is not working ...
ngtools/webpack above 1.8.0 is not working because of removing the decorators. ... Versions. Not using ng , just using @ngtools/webpack with webpack ....
Read more >
npm - @ngtools/webpack: Angular Compiler was detected but ...
This might be caused by a recent removing of decorators. ... So, I uninstalled node-sass module because I did not really needed it....
Read more >
module not found: error: can't resolve 'fs' angular - You.com
The error is because angular-CLI does not support modules in Nodejs like "fs" and "path". Add the following to the root of the...
Read more >
Component List of Infosys Nia Contracts Analysis
Component name Version License names @angular/animations 8.2.14 MIT License @angular/cdk 8.2.1 MIT License @angular/cli 8.3.29 MIT License
Read more >
javascript - becke.ch homepage
This is a problem because [undefined] does not tell us which function we are ... After the steps above haven been performed and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found