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.

Build outputs between `@angular-devkit/build-angular` and `@angular-builders/custom-webpack` are different

See original GitHub issue

Describe 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"

Bildschirmfoto 2020-12-07 um 14 31 13

"builder": "@angular-builders/custom-webpack:browser",

Normally

Bildschirmfoto 2020-12-07 um 14 31 55

With web workers enabled

Bildschirmfoto 2020-12-07 um 14 32 07

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:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
briananderson1222commented, Dec 7, 2020

@muuvmuuv npm i @angular-builders/custom-webpack@next to get the Angular 11 version (currently in beta)

0reactions
allcontributors[bot]commented, Dec 8, 2020

@just-jeb

I’ve put up a pull request to add @briananderson1222! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Buildtime increased by 50% in v12 · Issue #20792 · angular ...
In angular.json, replaced all traces of @angular-builders/custom-webpack:browser with @angular-devkit/build-angular:browser (and delete the ...
Read more >
@angular-builders/custom-webpack - npm
Custom webpack builders for Angular build facade. Allow to modify Angular build configuration without ejecting it. Latest version: 14.1.0, ...
Read more >
How To Use Custom webpack Configurations with Angular ...
Learn how to create a custom webpack config inside an Angular project using CLI Builders. This example will reduce the file size of...
Read more >
How to speed up Angular CLI app with esbuild-loader
our build is faster, but it's way bigger - ~760kb instead of ~170kb. This article will try a different approach to harvest esbuild...
Read more >
Upgraded From Angular 9 to 14 - build:ssr leads to Module ...
I decided to created a brand new angular 14 app and checked the version difference and noticed my angular builder was a few...
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