Skip to content

Generating sourcemaps in production fails with no error #9109

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
sjml opened this issue Jan 6, 2018 · 5 comments
Closed

Generating sourcemaps in production fails with no error #9109

sjml opened this issue Jan 6, 2018 · 5 comments
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix

Comments

@sjml
Copy link

sjml commented Jan 6, 2018

Versions

Angular CLI: 1.6.1
Node: 9.3.0
OS: darwin x64
Angular: 5.1.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.1
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.1
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0

Repro steps

  • Run ng serve or ng build; app runs and builds fine.
  • Run ng build --prod and get error.
  • Run ng build --prod --sourcemaps and build fails silently.

Observed behavior

I'm running into the bug that I've seen mentioned elsewhere (#7509), where building in production mode fails at the Uglify step with this error:

ERROR in main.e2a4502596f798d8da48.bundle.js from UglifyJs
Unexpected token: punc ()) [main.e2a4502596f798d8da48.bundle.js:19927,4]

That it's happening in the main bundle makes me think it's my code, so I was trying to enable sourcemaps to track it down, as recommended here. However, when I enable sourcemaps, the build just quietly fails with no error message, but also no dist directory. 😭 Even with the --verbose flag, I don't see anything particularly useful -- it just gets up to 92% chunk asset optimization and then dies. (The process even exits with a 0 code!)

%> ng build --prod --sourcemaps --verbose
10892ms building modules
4ms sealing
1ms optimizing
0ms basic module optimization
8ms module optimization
12ms advanced module optimization
2ms basic chunk optimization
0ms chunk optimization
1ms advanced chunk optimization
219ms building modules
0ms module and chunk tree optimization
8ms chunk modules optimization
1ms advanced chunk modules optimization
0ms module reviving
7ms module order optimization
2ms module id optimization
0ms chunk reviving
3ms chunk order optimization
3ms chunk id optimization
47ms hashing
1ms module assets processing
468ms chunk assets processing
1ms additional chunk assets processing
1ms recording
0ms additional asset processing
 92% chunk asset optimization%

%> echo $?
0
%> ls dist
gls: cannot access 'dist': No such file or directory

Desired behavior

I'd like to be able to generate sourcemaps to see where the problem is being introduced, or at least see an error message as they fail.

@whyboris
Copy link

whyboris commented Jan 8, 2018

I kept getting the same error (at 92% as well) but I think it may have been solved now that I upgraded to CLI 1.6.3 note

@clydin
Copy link
Member

clydin commented Jan 8, 2018

Please try updating the project to the latest CLI version (1.6.3). Also, if the problem persists after an upgrade please provide the output of npm ls uglify-es.

@clydin clydin self-assigned this Jan 8, 2018
@clydin clydin added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix labels Jan 8, 2018
@hansl hansl unassigned clydin Feb 6, 2018
@sjml
Copy link
Author

sjml commented Mar 7, 2018

Fixed in latest cli.

@sjml sjml closed this as completed Mar 7, 2018
@naguibihab
Copy link

It is --source-map now not --sourcemaps so I don't know how is it working for you guys especially when you update the CLI to 6+

@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
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix
Projects
None yet
Development

No branches or pull requests

4 participants