Skip to content

Source maps not loading for script added through .angular-cli.json #7226

Closed

Description

@adamlubek

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Versions.

@angular/cli: 1.2.6
node: 6.9.5
os: win32 x64
@angular/animations: 4.3.1
@angular/common: 4.3.1
@angular/compiler: 4.3.1
@angular/compiler-cli: 4.3.1
@angular/core: 4.3.1
@angular/forms: 4.3.1
@angular/http: 4.3.1
@angular/platform-browser: 4.3.1
@angular/platform-browser-dynamic: 4.3.1
@angular/router: 4.3.1
@angular/upgrade: 4.3.1
@angular/cli: 1.2.6
@angular/language-service: 4.3.1

Repro steps.

In .angular-cli.json, scripts section I've got reference to legacy library written in AngularJS with IFFEies which is bundled with gulp-uglify.

      "scripts": [
        "../node_modules/legacy-lib/lib.js"
      ]

legacy-lib also contains source maps for lib ("../node_modules/legacy-lib/lib.js.map") which are generated using gulp-sourcemaps.

Functionality of this legacy library is used within Angular CLI based hybrid app. When using "ng serve -o" library is loaded and works fine but I can only see minified version in dev tools, I don't see source maps file.

Desired functionality.

I'd like source maps for legacy library to be included in build and picked up by browser dev tools so I can debug. This sounds like common scenario to me so I'm probably just missing something but I can't find anything relevant in docs or issues. I'd appreciate guidance on how to enable this functionality.

Mention any other details that might be useful.

Legacy library is based on https://github.com/johnpapa/generator-hottowel and it's build system.

Activity

  1. self-assigned this
    on Aug 2, 2017
  2. added
    needs: investigationRequires some digging to determine if action is needed
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    on Aug 2, 2017
  3. alastair-todd commented on Aug 3, 2017

    @alastair-todd

    +1

  4. alastair-todd commented on Aug 3, 2017

    @alastair-todd

    FWIW whilst not the desired route, you can add debugger statements in those files and chrome does show a debuggable file, although these are not available through sources.

    There was a similar issue with node_modules not having sourcemaps either, not sure if that was fixed.

  5. adamlubek commented on Aug 3, 2017

    @adamlubek
    Author

    another workaround is to include source maps through .angular-cli.json assets section:

          "assets": [
            "assets",
            { "glob": "somelib.js.map", "input": "../node_modules/somelib/", "output": "./" }
          ],
    

    but this will also mean that prod builds will contain source maps (which can be fixed by adding build script to delete these in the end of the build - not ideal but would do the job)

    are you referring to this one: #5477

  6. added 3 commits that reference this issue on Aug 15, 2017
    3ab491b
    02c28b3
    08b514a
  7. added a commit that references this issue on Aug 17, 2017
    e8f27f0
  8. added a commit that references this issue on Apr 23, 2018
    14e0b9c
  9. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  10. locked and limited conversation to collaborators on Sep 7, 2019
  11. added a commit that references this issue on May 29, 2026
    52f1921
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentneeds: investigationRequires some digging to determine if action is neededtype: bug/fix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions