Skip to content

Silence UlgifyJS warnings #3068

Closed
Closed
@mgol

Description

@mgol

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

macOS Sierra 10.12.1 (16B2555)

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.19-3
node: 7.0.0
os: darwin x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

I just invoked:

ng new test-app
cd test-app
ng build --prod --aot

The log given by the failure.

Normally this include a stack trace and some more information.

Lots of warnings like:

WARNING in main.55f62913a98db261318d.bundle.js from UglifyJs
Dropping unused function isStrictStringMap [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/core/src/facade/lang.js:44,0]
Dropping unused function isDate [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/core/src/facade/lang.js:47,0]
Dropping unused function setValueOnPath [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/core/src/facade/lang.js:112,0]
Dropping unused function escapeRegExp [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/core/src/facade/lang.js:152,0]
Side effects in initialization of unused variable STRING_MAP_PROTO [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/core/src/facade/lang.js:43,0]
Side effects in initialization of unused variable NumberWrapper [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/core/src/facade/lang.js:67,0]
Dropping unused function setDOM [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/platform-browser/src/dom/dom_adapter.js:12,0]
Dropping unused function scheduleMicroTask [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/common/src/facade/lang.js:21,0]
Dropping unused function isStrictStringMap [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/common/src/facade/lang.js:44,0]
Dropping unused function looseIdentical [/Users/mgol/Workspace/angular2-test/test-app/~/@angular/common/src/facade/lang.js:100,0]

Mention any other details that might be useful.

UlgifyJS prints warnings for every piece of dead code it strips as it was a user error that some unneeded code is there. Maybe that's the case for a lot of regular projects but this is a pretty normal scenario for Angular's tree shaking. It'd be good to silence those warnings (but not potential errors) so that it doesn't look so unnecessary scary and so that it doesn't push the final Webpack output way beyond the screen.


Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions