Skip to content

Optimization of inline scripts behaves differently with default settings vs explicitly defined minification #20207

Closed
@kmaraz

Description

@kmaraz

🐞 bug report

Description

In the documentation for Optimization configuration https://angular.io/guide/workspace-config#optimization-configuration it is stated that:

option: scripts - Enables optimization of the scripts output.
and the default value is TRUE

So based on default values mentioned in the documentation I thought that

"optimization": { 
  "scripts": true,
  "styles": {
    "minify": true,
    "inlineCritical": false
  },
  "fonts": true
}

is the same as:

"optimization": true

But the two behaves differently. The explicit configuration of optimization.scripts = true option turns on aggresive minification of inlined <script>s in the index.html which is not enabled when only optimization = true is set.

Did I get it wrong and it should behave differently?

🌍 Your Environment

Angular Version:


  "@angular-builders/custom-webpack": "^11.1.0",
    "@angular-devkit/build-angular": "^0.1102.2",
    "@angular-eslint/eslint-plugin": "^1.2.0",
    "@angular-eslint/eslint-plugin-template": "^1.2.0",
    "@angular-eslint/template-parser": "^1.2.0",
    "@angular/animations": "^11.2.3",
    "@angular/cdk": "^11.2.2",
    "@angular/cli": "^11.2.2",
    "@angular/common": "^11.2.3",
    "@angular/compiler": "^11.2.3",
    "@angular/compiler-cli": "^11.2.3",
    "@angular/core": "^11.2.3",
    "@angular/elements": "^11.2.3",
    "@angular/forms": "^11.2.3",
    "@angular/language-service": "^11.2.3",
    "@angular/material": "^11.2.2",
    "@angular/material-moment-adapter": "^11.2.2",
    "@angular/platform-browser": "^11.2.3",
    "@angular/platform-browser-dynamic": "^11.2.3",
    "@angular/router": "^11.2.3",

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions