-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Closed
Labels
area: @angular-devkit/build-angularfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity5: regressiontype: bug/fix
Milestone
Description
🐞 Bug report
Command (mark with an x
)
- new
- [X ] build
- serve
- [X ] test
- [X ] e2e
- generate
- add
- update
- lint
- [X ] xi18n
- run
- config
- help
- version
- doc
Is this a regression?
The bug was introduced by this commit:
770de94#diff-86d5f24a73f7db8e65c3e66c4dab5205
Description
Our project does not have budgets set for all configurations. After upgrading to Angular 9, it cannot be built because of the following exception during the build process.
Calls to Array.reduce
functions are missing default values here https://github.com/angular/angular-cli/blob/9.0.x/packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator.ts
🔬 Minimal Reproduction
We do not any simple reproducer, however the bug is obvious from the code directly.
🔥 Exception or Error
[error] TypeError: Reduce of empty array with no initial value
at Array.reduce (<anonymous>)
at Object.values.map (/project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/utilities/bundle-calculator.js:151:18)
at Array.map (<anonymous>)
at BundleCalculator.calculate (/project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/utilities/bundle-calculator.js:147:65)
at calculateSizes (/project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/utilities/bundle-calculator.js:101:23)
at Object.checkBudgets (/project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/utilities/bundle-calculator.js:271:23)
at checkBudgets.next (<anonymous>)
at BundleBudgetPlugin.runChecks (/project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/bundle-budget.js:22:40)
at compiler.hooks.afterEmit.tap (/project/node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/bundle-budget.js:14:18)
at _next0 (eval at create (/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:19:1)
at _err0 (eval at create (/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:44:1)
at compiler.hooks.afterEmit.tapAsync (/project/node_modules/copy-webpack-plugin/dist/index.js:115:7)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:40:1)
at AsyncSeriesHook.lazyCompileHook (/project/node_modules/tapable/lib/Hook.js:154:20)
at asyncLib.forEachLimit.err (/project/node_modules/webpack/lib/Compiler.js:482:27)
at /project/node_modules/neo-async/async.js:2818:7
🌍 Your Environment
Even after adding the default budgets config, it still fails.
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
Metadata
Metadata
Assignees
Labels
area: @angular-devkit/build-angularfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity5: regressiontype: bug/fix