Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): exclude map files from 'bundle' b…
Browse files Browse the repository at this point in the history
…udgets
  • Loading branch information
NickGeek authored and alexeagle committed May 30, 2019
1 parent 8775c17 commit 2cb237d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Expand Up @@ -48,6 +48,7 @@ class BundleCalculator extends Calculator {
const size: number = this.compilation.chunks
.filter(chunk => chunk.name === this.budget.name)
.reduce((files, chunk) => [...files, ...chunk.files], [])
.filter((file: string) => !file.endsWith('.map'))
.map((file: string) => this.compilation.assets[file].size())
.reduce((total: number, size: number) => total + size, 0);

Expand Down
Expand Up @@ -65,6 +65,18 @@ describe('Browser Builder bundle budgets', () => {
});

describe(`should ignore '.map' files`, () => {
it(`when 'bundle' budget`, async () => {
const overrides = {
optimization: true,
budgets: [{ type: 'bundle', name: 'main', maximumError: '3Kb' }],
};

const run = await architect.scheduleTarget(targetSpec, overrides);
const output = await run.result;
expect(output.success).toBe(true);
await run.stop();
});

it(`when 'intial' budget`, async () => {
const overrides = {
optimization: true,
Expand Down

0 comments on commit 2cb237d

Please sign in to comment.