custom-webpack:server errors with Cannot read properties of undefined (reading 'colors')
See original GitHub issueDescribe the Bug
When using the @angular-builders/custom-webpack:server builder, it is erroring with the following error.
TypeError: Cannot read properties of undefined (reading 'colors')
at statsToString (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-angular/src/webpack/utils/stats.js:193:32)
at webpackStatsLogger (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-angular/src/webpack/utils/stats.js:374:17)
at MergeMapSubscriber.project (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-angular/src/builders/server/index.js:93:44)
at MergeMapSubscriber._tryNext (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/mergeMap.js:67:27)
at MergeMapSubscriber._next (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/mergeMap.js:57:18)
at MergeMapSubscriber.Subscriber.next (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:66:18)
at SafeSubscriber.__tryOrUnsub (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-webpack/node_modules/rxjs/internal/Subscriber.js:205:16)
at SafeSubscriber.next (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-webpack/node_modules/rxjs/internal/Subscriber.js:143:22)
at Subscriber._next (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-webpack/node_modules/rxjs/internal/Subscriber.js:89:26)
at Subscriber.next (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-webpack/node_modules/rxjs/internal/Subscriber.js:66:18)
at SwitchMapSubscriber.notifyNext (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-webpack/node_modules/rxjs/internal/operators/switchMap.js:85:26)
at SimpleInnerSubscriber._next (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-webpack/node_modules/rxjs/internal/innerSubscribe.js:27:21)
at SimpleInnerSubscriber.Subscriber.next (/Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-webpack/node_modules/rxjs/internal/Subscriber.js:66:18)
at /Users/zach.morgan/Development/mfe-universal/node_modules/@angular-devkit/build-webpack/src/webpack/index.js:58:25
at /Users/zach.morgan/Development/mfe-universal/node_modules/webpack/lib/HookWebpackError.js:68:3
at Hook.eval [as callAsync] (eval at create (/Users/zach.morgan/Development/mfe-universal/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
If I dont specify a customWebpackConfig
, it works fine. However, as soon as I specify one, it errors. Even if the custom webpack config is essentially empty.
Minimal Reproduction
I kept the original server
target and created a server-custom
target for the repro.
https://github.com/sir-captainmorgan21/angular-builders-custom-webpack-sever-repro
Expected Behavior
I’d expect this to run without errors.
Environment
Libs
- @angular/core version: ~14.2.0
- @angular-devkit/build-angular version: ~14.2.0
- @angular-builders/custom-webpack version: ^14.0.1
Issue Analytics
- State:
- Created 10 months ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
TypeError: Cannot read properties of undefined (reading 'color')
The browser is throwing an error TypeError: Cannot read properties of undefined (reading 'color') . Here is my utilities.js file which is ...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Cannot read properties of undefined (reading 'displayMode ...
What happened: A Grafana v8.3.6 to B Grafana v8.3.6 Panel JSON Error TypeError: Cannot read properties of undefined (reading 'displayMode') ...
Read more >Uncaught TypeError : Cannot read properties of undefined
Looking for ways to handle Uncaught TypeError: Cannot read property of undefined in JavaScript? This guide will help you to catch errors.
Read more >KB303816: "Cannot read property 'layouts' of undefined" error ...
When users create a Financial Reporting dashboard and selecting a large amount of elements from a hierarchy in the filter panel e.g. >...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It merges when it exports an object, but it doesn’t merge when it exports a factory function:
@just-jeb that was it. Thanks! I actually re-read through your docs, and was able to find that. May be a good place for a trouble shooting section though.