Skip to content

Generating sourcemaps in production fails with no error #9109

@sjml

Description

@sjml

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenttype: bug/fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions