Skip to content

Building project with sourcemaps fails #11118

@miguskar

Description

@miguskar

Versions

OS: macOS (High Sierra)

Angular CLI: 6.0.1
Node: 8.11.2
NPM: 6.0.1
OS: darwin x64
Angular: 6.0.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.1
@angular-devkit/build-angular     0.6.1
@angular-devkit/build-optimizer   0.6.1
@angular-devkit/core              0.6.1
@angular-devkit/schematics        0.6.1
@angular/cli                      6.0.1
@ngtools/webpack                  6.0.1
@schematics/angular               0.6.1
@schematics/update                0.6.1
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Repro steps

Example repository is an app with an external dependency sweetalert2
Example repo: https://github.com/miguskar/ng-example-app
Stackblitz of same repo: https://stackblitz.com/github/miguskar/ng-example-app

  • Step 1: npm i
  • Step 2: npm run build:sm // build with source maps

Observed behavior

An external JS package (sweetalert2) is breaking the build when building the app with sourcemaps enabled.

> ng-example-app@0.0.0 build:sm /Users/mk/normative/stuff/ng-example-app
> ng build --configuration=production


Date: 2018-06-05T15:00:03.012Z
Hash: 81614cde42c2e965fae1
Time: 16808ms
chunk {0} runtime.6afe30102d8fe7337431.js, runtime.6afe30102d8fe7337431.js.map (runtime) 1.11 kB [entry] [rendered]
chunk {1} styles.5a8b98837357f6c30e89.css, styles.5a8b98837357f6c30e89.css.map (styles) 59 bytes [initial] [rendered]
chunk {2} polyfills.e7992d098ebc20f9d82d.js, polyfills.e7992d098ebc20f9d82d.js.map (polyfills) 59.6 kB [initial] [rendered]
chunk {3} main.e04b8612bc19d2ceb29b.js, main.e04b8612bc19d2ceb29b.js.map (main) 237 kB [initial] [rendered]

ERROR in ./node_modules/sweetalert2/dist/sweetalert2.all.js
Module build failed: RangeError: Maximum call stack size exceeded
    at skipSourceTrivia (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:68075:34)
    at emitNodeWithSourceMap (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:68269:29)
    at pipelineEmitWithSourceMap (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:70981:17)
    at emitNodeWithNestedComments (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:68568:17)
    at emitNodeWithSynthesizedComments (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:68518:13)
    at emitNodeWithComments (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:68488:21)
    at pipelineEmitWithComments (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:70973:17)
    at emitNodeWithNotification (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:67902:21)
    at pipelineEmitWithNotification (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:70964:17)
    at emitExpression (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:70960:13)
    at emitBinaryExpression (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:71846:13)
    at pipelineEmitExpression (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:71317:28)
    at pipelineEmitWithHint (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:70991:49)
    at emitNodeWithSourceMap (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:68279:21)
    at pipelineEmitWithSourceMap (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:70981:17)
    at emitNodeWithNestedComments (/Users/mk/normative/stuff/ng-example-app/node_modules/typescript/lib/typescript.js:68568:17)

Desired behavior

The build should finish without error

Mention any other details that might be useful (optional)

Building the same project without sourcemaps works fine (ng build --configuration=production --sourceMap=false)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions