Build outputs between `@angular-devkit/build-angular` and `@angular-builders/custom-webpack` are different
See original GitHub issueDescribe the Bug
I currently have an issue with web workers that angular tries to always compiler just one at a time which results in duplicated code files (). Then I tried to find out where this is coming from and started a new angular project and added step by step what I am doing with web workers in my app.
At the end after adding custom-webpack I got the below error and also recognized another thing: the build output at all is completely different to the new ng11 build output. My error went away when I removed custom-webpack
, so I guess just an internal update from the part where it passes the config to the original angular compiler is needed.
Details
❯ npm run build
> test@0.0.0 build /Users/marvinheilemann/Desktop/test-von-donnerstag
> ng build
WARNING in /Users/marvinheilemann/Desktop/test-von-donnerstag/src/environments/environment.ts depends on 'zone.js/dist/zone-error'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
ERROR in ./src/app/workers/two.worker.ts (./node_modules/worker-plugin/dist/loader.js?name=1!./src/app/workers/two.worker.ts)
Module build failed (from ./node_modules/worker-plugin/dist/loader.js):
Error: TypeError: Cannot read property 'getOptionsDiagnostics' of undefined
at AngularCompilerPlugin._emit (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:1037:54)
at AngularCompilerPlugin._update (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:883:50)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async AngularCompilerPlugin._make (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:760:13)
at /Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:886:79
at Object.reportDiagnostics (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/diagnostics.js:131:9)
at AngularCompilerPlugin._update (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:886:23)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async AngularCompilerPlugin._make (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:760:13)
@ ./src/app/app.component.ts 1:0-134
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi ./src/main.ts2m
ERROR in TypeError: Cannot read property 'getOptionsDiagnostics' of undefined
at AngularCompilerPlugin._emit (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:1037:54)
at AngularCompilerPlugin._update (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:883:50)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async AngularCompilerPlugin._make (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:760:13)
ERROR in TypeError: Cannot read property 'kind' of undefined
at areDeclarationFlagsIdentical (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:72438:71)
at checkVariableLikeDeclaration (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:72408:22)
at checkVariableDeclaration (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:72455:20)
at checkSourceElementWorker (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:75060:28)
at checkSourceElement (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:74907:17)
at Object.forEach (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:382:30)
at checkVariableStatement (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:72465:16)
at checkSourceElementWorker (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:75029:28)
at checkSourceElement (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:74907:17)
at Object.forEach (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:382:30)
at checkSourceFileWorker (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:75246:20)
at checkSourceFile (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:75214:13)
at getDiagnosticsWorker (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:75302:17)
at Object.getDiagnostics (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:75288:24)
at /Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:103754:85
at runWithCancellationToken (/Users/marvinheilemann/Desktop/test-von-donnerstag/node_modules/@angular-builders/custom-webpack/node_modules/typescript/lib/typescript.js:103716:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test@0.0.0 build: `ng build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test@0.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/marvinheilemann/.npm/_logs/2020-12-07T13_31_33_594Z-debug.log
Minimal Reproduction
https://github.com/muuvmuuv/angular-worker-issue
Expected Behavior
Same output as in standard angular builder.
Screenshots
"builder": "@angular-devkit/build-angular:browser"
"builder": "@angular-builders/custom-webpack:browser",
Normally
With web workers enabled
Environment
Libs
see project
For Tooling issues:
- Node version: v14.15.1
- Platform: Mac 10.15.7
Others:
Additional Context
Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
@muuvmuuv
npm i @angular-builders/custom-webpack@next
to get the Angular 11 version (currently in beta)@just-jeb
I’ve put up a pull request to add @briananderson1222! 🎉