Skip to content

update: budgets section is corrupted on ng update  #15462

Closed
@Splaktar

Description

@Splaktar

🐞 Bug report

Command

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [x] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Not sure as this is the first time using ng update after adding budgets.

Description

angular.json file's budgets section is corrupted on ng update @angular/cli --next.

🔬 Minimal Reproduction

  1. Start with a project based on
    "@angular-devkit/build-angular": "~0.803.0",
    "@angular/cli": "8.3.0",
    and build config below.
  2. Run ng update @angular/cli --next --force
  3. Commit files
  4. Run ng update @angular/material

🔥 Exception or Error


An unhandled exception occurred: Workspace config file cannot be loaded: /Users/splaktar/Git/devintent/devintent/angular.json
Invalid JSON character: "{" at 37:32.
See "/private/var/folders/3w/d8jpfpm16xs1ktpq20zprl880000gn/T/ng-PJGl3A/angular-errors.log" for further details.

Contents of that log file

[error] Error: Workspace config file cannot be loaded: /Users/splaktar/Git/devintent/devintent/angular.json
Invalid JSON character: "{" at 37:32.
    at getWorkspace (/Users/splaktar/Git/devintent/devintent/node_modules/@angular/cli/utilities/config.js:58:15)

🌍 Your Environment

Before


Angular CLI: 8.3.0
Node: 12.3.0
OS: darwin x64
Angular: 8.2.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.0
@angular-devkit/build-angular     0.803.0
@angular-devkit/build-optimizer   0.803.0
@angular-devkit/build-webpack     0.803.0
@angular-devkit/core              8.3.0
@angular-devkit/schematics        8.3.0
@angular/cdk                      8.1.4
@angular/cli                      8.3.0
@angular/fire                     5.2.1
@angular/flex-layout              8.0.0-beta.26
@angular/material                 8.1.4
@angular/pwa                      0.803.0
@ngtools/webpack                  8.3.0
@schematics/angular               8.3.0
@schematics/update                0.803.0
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.39.2

After


Angular CLI: 9.0.0-next.0
Node: 12.3.0
OS: darwin x64
Angular: 9.0.0-next.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
... service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.0
@angular-devkit/build-angular     0.900.0-next.0
@angular-devkit/build-optimizer   0.900.0-next.0
@angular-devkit/build-webpack     0.900.0-next.0
@angular-devkit/core              8.3.0
@angular-devkit/schematics        8.3.0
@angular/cdk                      8.1.4
@angular/cli                      9.0.0-next.0
@angular/fire                     5.2.1
@angular/flex-layout              8.0.0-beta.26
@angular/language-service         8.2.3
@angular/material                 8.1.4
@angular/pwa                      0.803.0
@ngtools/webpack                  9.0.0-next.0
@schematics/angular               8.3.0
@schematics/update                0.900.0-next.0
rxjs                              6.5.2
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?
angular.json before:

          "configurations": {
            "production": {
              "budgets": [{
                "type": "bundle",
                "name": "main",
                "maximumWarning": "650kb",
                "maximumError": "1000kb"
              }],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            }
          }

angular.json after ng update:

         "configurations": {
            "production": {
              "budgets": [{
                "type": "bundle",
                "name": "main",
                "maximumWarning": "650kb",
                "maximumError": "1000kb"
              },]                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
,
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            }
          }

angular.json after manually fixing:

          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "bundle",
                  "name": "main",
                  "maximumWarning": "650kb",
                  "maximumError": "1000kb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "serviceWorker": true,
              "ngswConfigPath": "ngsw-config.json"
            }
          }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions