Skip to content

initial budget doesn't trigger #11712

Closed
@StephenFluin

Description

@StephenFluin

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting

Command (mark with an x)

- [x] build

Versions

Angular CLI: 6.1.1
Node: 10.6.0
OS: linux x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.7.1
@angular-devkit/build-angular 0.7.1
@angular-devkit/build-optimizer 0.7.1
@angular-devkit/build-webpack 0.7.1
@angular-devkit/core 0.7.1
@angular-devkit/schematics 0.7.1
@angular/cdk 6.4.1
@angular/cli 6.1.1
@angular/material 6.4.1
@ngtools/webpack 6.1.1
@schematics/angular 0.7.1
@schematics/update 0.7.1
rxjs 6.2.2
typescript 2.7.2
webpack 4.9.2

Repro steps

  • ng new my-app
  • add 1MB to bundle so bundle is more than 1MB>
  • add budget to production config
"configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "budgets": [
                {
                  "type": "initial",
                  "maximumError": "2mb",
                  "maximumWarning": "1mb"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            }
          }
  • ng build --prod

The log given by the failure

$ ng build --prod
                                                                                       
Date: 2018-07-30T21:13:49.067Z
Hash: 677e685692de6cf92ad3
Time: 42319ms
chunk {0} runtime.a66f828dca56eeb90e02.js (runtime) 1.05 kB [entry] [rendered]
chunk {1} styles.1c3d66f2dd8412dae789.css (styles) 56.2 kB [initial] [rendered]
chunk {2} polyfills.7a0e6866a34e280f48e7.js (polyfills) 59.6 kB [initial] [rendered]
chunk {3} main.33c9a4510519d4aa7f61.js (main) 1.59 MB [initial] [rendered]

Desired functionality

A warning about being over 1MB is expected.
If I halve the sizes to 500kb warning and 1mb error, I get the same behavior and no error or warning is triggered.

Mention any other details that might be useful

I think that minimum (and related settings is confusing) and could be deprecated and removed in a future major.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions