Skip to content

Commit

Permalink
feat(@schematics/angular): add stricter bundle budgets when using the…
Browse files Browse the repository at this point in the history
… `--strict` option

When using the strict option `anyComponentStyle` and `initial` budgets are more strict.
  • Loading branch information
alan-agius4 authored and dgp1130 committed May 5, 2020
1 parent cbf0feb commit a7cf22c
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,34 @@ function addAppToWorkspaceFile(options: ApplicationOptions, appDir: string): Rul
}

const sourceRoot = join(normalize(projectRoot), 'src');
let budgets = [];
if (options.strict) {
budgets = [
{
type: 'initial',
maximumWarning: '500kb',
maximumError: '1mb',
},
{
type: 'anyComponentStyle',
maximumWarning: '2kb',
maximumError: '4kb',
},
];
} else {
budgets = [
{
type: 'initial',
maximumWarning: '2mb',
maximumError: '5mb',
},
{
type: 'anyComponentStyle',
maximumWarning: '6kb',
maximumError: '10kb',
},
];
}

const project = {
root: normalize(projectRoot),
Expand Down Expand Up @@ -219,17 +247,7 @@ function addAppToWorkspaceFile(options: ApplicationOptions, appDir: string): Rul
extractLicenses: true,
vendorChunk: false,
buildOptimizer: true,
budgets: [
{
type: 'initial',
maximumWarning: '2mb',
maximumError: '5mb',
},
{
type: 'anyComponentStyle',
maximumWarning: '6kb',
maximumError: '10kb',
}],
budgets,
},
},
},
Expand Down

0 comments on commit a7cf22c

Please sign in to comment.