Repository navigation
Description
Bug Report or Feature Request (mark with an x)
- [ x ] bug report -> please search issues before submitting
- [ ] feature request
Command (mark with an x)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Versions
Linux Ubuntu VERSION="16.04.4 LTS (Xenial Xerus)
node v10.10.0
npm 6.4.1
ng (none, this project is not managed by Angular CLI)
Angular 6
ngtools/webpack 1.10.2
"dependencies": {
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"@angular/router": "^6.0.0",
"@angular/upgrade": "^6.0.0",
"angular-in-memory-web-api": "^0.6.0",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "^0.8.24"
},
"devDependencies": {
"@angular/compiler-cli": "^6.0.0",
"@ngtools/webpack": "1.10.2",
"@types/node": "^6.0.45",
"lodash": "^4.16.2",
"typescript": "2.7.2",
"grunt": "~0.4.5",
"grunt-cli": "1.2.0",
"grunt-webpack": "3.1.3",
"webpack": "3.12.0",
"raw-loader": "0.5.1"
},
Repro steps
I created minimal sample app to reproduce this error. The key point is that this app is AOT compiled using the webpack plugin @ngtools/webpack.
How to reproduce
- git clone https://github.com/anbaran/ngtools-webpack-error.git
- cd ngtools-webpack-error/
- install grunt cli with: npm install -g grunt-cli (if you don't already have it)
- Run: npm install
- Run: grunt (this step will start AOT compilation of that project)
The log given by the failure
ERROR in : TypeError: Cannot read property 'getTsProgram' of undefined
at AngularCompilerPlugin._getTsProgram (<project-location>/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:189:62)
at getTypeChecker (<project-location>/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:533:43)
at ast_helpers_1.collectDeepNodes.filter (<project-location>/node_modules/@ngtools/webpack/src/transformers/remove_decorators.js:14:60)
at Array.filter (<anonymous>)
at standardTransform (<project-location>/node_modules/@ngtools/webpack/src/transformers/remove_decorators.js:14:14)
at transformer (<project-location>/node_modules/@ngtools/webpack/src/transformers/make_transform.js:14:25)
at <project-location>/node_modules/typescript/lib/typescript.js:2892:86
at reduceLeft (<project-location>/node_modules/typescript/lib/typescript.js:2585:30)
at <project-location>/node_modules/typescript/lib/typescript.js:2892:42
at transformRoot (<project-location>/node_modules/typescript/lib/typescript.js:67846:82)
Desired functionality
It should be possible to compile Angular 6 projects with Ahead-of-Time compiler using @ngtools/webpack plugin (without using the Angular CLI)
Mention any other details that might be useful
Using @ngtools/webpack for AOT compiling works in my setup until version 1.8 which is ok for Angular 5. However, Angular 6 requires to have at least @ngtools/webpack 1.10.0 which causes the above error.
Activity
anbaran commentedon Sep 14, 2018
I made further investigation and it turns out that even though the error occurs in AngularCompilerPlugin, it occurs only when running @ngtools/webpack via grunt-webpack integration (I use grunt for building the application). If compiling is done directly via webpack it works without problems. I modified the sample minimal app to have both options possible i.e. compile via grunt-webpack integration and compile directly via webpack (see the app repository for instructions https://github.com/anbaran/ngtools-webpack-error)
I also submitted a bug error to grunt-webpack project (danez/grunt-webpack#168)
p3x-robot commentedon Sep 14, 2018
I have been trying to fix this for about over 6 months, finally someone found the bug, reference:
#12179
I guess it will work from now on.
alan-agius4 commentedon Oct 4, 2018
Closing in favor of the upstream tracked issue.
angular-automatic-lock-bot commentedon Sep 8, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.