Skip to content

ng build --prod still does NOT minify / uglify / remove comments using angular-cli 9 (and 8) #17550

@eranzim

Description

@eranzim

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

Yes, but I don't know what is the previous version in which this bug was not present.

Description

When I build my Angular project with ng build --prod, all comments remain in the html, spaces aren't removed, etc. Seems like no minification / uglification / comment removal is taking place.

🔬 Minimal Reproduction

Simply: ng build --prod (run on a basic project with an html comment in index.html

🔥 Exception or Error

No exception, just doesn't minify / uglify / remove comments when it should.

🌍 Your Environment


Angular CLI: 9.1.3
Node: 12.16.2
OS: win32 x64

Angular: 9.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.3
@angular-devkit/build-angular     0.901.3
@angular-devkit/build-optimizer   0.901.3
@angular-devkit/build-webpack     0.901.3
@angular-devkit/core              9.1.3
@angular-devkit/schematics        9.1.3
@angular/cdk                      9.2.1
@angular/material                 9.2.1
@ngtools/webpack                  9.1.3
@schematics/angular               9.1.3
@schematics/update                0.901.3
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0

Anything else relevant?

I'm running this on Windows 10 x64, if that matters.

Somewhat duplicate of #9973, however still not solved in Angular 8 or 9 (I had 8 and upgraded to 9 in the hopes that it would be fixed there, but it isn't). Also, the previously suggested workaround of running ng build --target=production --environment=prod doesn't work, it gives an error message:


Unknown option: '--target'
Unknown option: '--environment'

Thanks!!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions