Angular-cli: --prod build fails on UglifyJs with "undefined" error message on es5

Created on 8 Oct 2018  Â·  11Comments  Â·  Source: angular/angular-cli

Bug Repor

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

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

Versions

node --version : 5.1.0

ng --version

 / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.2.4
Node: 8.11.3
OS: darwin x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.8.4
@angular-devkit/build-angular     0.8.4
@angular-devkit/build-optimizer   0.8.4
@angular-devkit/build-webpack     0.8.4
@angular-devkit/core              0.8.4
@angular-devkit/schematics        0.8.4
@angular/cli                      6.2.4
@angular/language-service         4.4.7
@ngtools/webpack                  6.2.4
@schematics/angular               0.8.4
@schematics/update                0.8.4
rxjs                              5.5.12
typescript                        2.4.2

Repro steps

I run "ng build --prod".

The log given by the failure

Date: 2018-10-08T08:32:05.461Z
Hash: 74f0598df6b8233262d2
Time: 25640ms
chunk {scripts} scripts.b8e8114c722336f4e67f.js (scripts) 525 kB [rendered]
chunk {0} runtime.ec2944dd8b20ec099bf3.js (runtime) 1.44 kB [entry] [rendered]
chunk {1} main.3d4547cca3b3a51145ac.js (main) 1.79 MB [initial] [rendered]
chunk {2} polyfills.fdb7818e5a930dae1ea1.js (polyfills) 103 kB [initial] [rendered]
chunk {3} styles.73c5b4cf018b22bdc892.css (styles) 1.17 MB [initial] [rendered]

ERROR in scripts.b8e8114c722336f4e67f.js from UglifyJs
undefined

Desired functionality

Build succeeds without error.

Mention any other details that might be useful

  • it works without "--prod"
  • it works if I change "target" to "es2015" in src/tsconfig.app.json (now it's "es5") but I don't want to loose IE11 support now.
  • I tried "--source-map" but it did not give more informations

thanks

repro steps

Most helpful comment

everyone having this error, see the referenced issue in tether HubSpot/tether/issues/295

to get your apps working again lower the version from 1.4.5 to 1.4.4

All 11 comments

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

here is my repro : https://github.com/RemiBou/angular-cli-repro-12506

it seems to be connected to my included scripts, I'll try to dig, but maybe it can help you add a more descriptive error message

removing tether dependency and removing it from scripts[] fixed my issue, I don't need it as bootstrap 4 depends only on popper.js. But still the error is confusing

I'm sorry, but this issue is not caused by Angular CLI. Please contact the author(s) of the https://github.com/terser-js/terser project or file an issue on their issue tracker.

I can't see any reference to terser in my package-lock.json, are you sure this is not a bug in uglify-js ?

I'm having exactly the same problem as of about a week ago. I also have no references or package lock to terser

Im alsi having the same issue!

everyone having this error, see the referenced issue in tether HubSpot/tether/issues/295

to get your apps working again lower the version from 1.4.5 to 1.4.4

@vmasek It works!! Thank you buddy - saved me propably 10000 hours ;)
I had to lower the version of tether from 1.4.5 to 1.4.4

everyone having this error, see the referenced issue in tether HubSpot/tether/issues/295

to get your apps working again lower the version from 1.4.5 to 1.4.4

@vmasek Than you so much I was "struggling to death" with this :)

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings