Skip to content

Commit a976e45

Browse files
NickGeekalexeagle
authored andcommitted
fix(@angular-devkit/build-angular): exclude map files from 'bundle' budgets
1 parent e7419d5 commit a976e45

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

packages/angular_devkit/build_angular/src/angular-cli-files/utilities/bundle-calculator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class BundleCalculator extends Calculator {
4848
const size: number = this.compilation.chunks
4949
.filter(chunk => chunk.name === this.budget.name)
5050
.reduce((files, chunk) => [...files, ...chunk.files], [])
51+
.filter((file: string) => !file.endsWith('.map'))
5152
.map((file: string) => this.compilation.assets[file].size())
5253
.reduce((total: number, size: number) => total + size, 0);
5354

packages/angular_devkit/build_angular/test/browser/bundle-budgets_spec_large.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ describe('Browser Builder bundle budgets', () => {
6565
});
6666

6767
describe(`should ignore '.map' files`, () => {
68+
it(`when 'bundle' budget`, async () => {
69+
const overrides = {
70+
optimization: true,
71+
budgets: [{ type: 'bundle', name: 'main', maximumError: '3Kb' }],
72+
};
73+
74+
const run = await architect.scheduleTarget(targetSpec, overrides);
75+
const output = await run.result;
76+
expect(output.success).toBe(true);
77+
await run.stop();
78+
});
79+
6880
it(`when 'intial' budget`, async () => {
6981
const overrides = {
7082
optimization: true,

0 commit comments

Comments
 (0)