Skip to content

Unable to build using --prod flag. Indeterminable error returned during UglifyJs process. #12064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jacknkandy opened this issue Sep 1, 2018 · 4 comments
Labels
area: @angular-devkit/build-angular needs: repro steps We cannot reproduce the issue with the information given
Milestone

Comments

@jacknkandy
Copy link

Bug Report or Feature Request (mark with an x)

- [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: 8.11.1
Npm: 5.6.0
Angular Cli: 6.1.5

Repro steps

Building with --prod, e.g. ng build --prod returns an error:

ERROR in main.55704d1fa620b76d62c5.js from UglifyJs
Unexpected token: punc ()) [main.55704d1fa620b76d62c5.js:75494,2]

As per #5741 I attempted to troubleshoot this issue by adding the --source-map flag, e.g. ng build --prod --source-map and the build is successful, with no errors reported. As the output has been Uglified I am unable to find the line number that is being referenced to determine the cause of this problem.

Why is it that the build would be successful with the --source-map flag added? Is this normal behaviour?

The log given by the failure

As above.

Desired functionality

Build should be successful.

Mention any other details that might be useful

Seems to be related to #5741 but I am not sure how identify the problem to resolve this issue.

Any help will be greatly appreciated!

@jacknkandy
Copy link
Author

jacknkandy commented Sep 1, 2018

Okay I was able to resolve my issue by modifying my angular.json file. I changed the following settings:

{
  "build": {
    "configurations": {
      "production": {
          "sourceMap": true,
          "aot": false,
          "buildOptimizer": false
      }
    }
  }
}

And then after running ng build --prod the actual file and line of code was reported along with the original error.

ERROR in main.0936b2c9f69e2de06dab.js from UglifyJs
Unexpected token: punc ()) [./src/app/core/services/mapbox/custom-modes/measure-radius.js:113,0][main.0936b2c9f69e2de06dab.js:109689,2]

I find this to be quite strange. I'm not really understanding why the build was successful after adding the --source-map flag (without changing any settings in the angular.json file).

This seems to be a bug, can anyone with better knowledge about the cli comment?

@alan-agius4
Copy link
Collaborator

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.

@alan-agius4 alan-agius4 added needs: repro steps We cannot reproduce the issue with the information given area: @angular-devkit/build-angular labels Sep 2, 2018
@ngbot ngbot bot added this to the needsTriage milestone Sep 2, 2018
@filipesilva
Copy link
Contributor

Closing as no repro has been provided.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular-devkit/build-angular needs: repro steps We cannot reproduce the issue with the information given
Projects
None yet
Development

No branches or pull requests

3 participants