Skip to content

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

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
adamlubek opened this issue Sep 19, 2017 · 3 comments
Closed

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

adamlubek opened this issue Sep 19, 2017 · 3 comments
Labels
P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix

Comments

@adamlubek
Copy link

adamlubek commented Sep 19, 2017

Bug Report or Feature Request (mark with an x)

- [x] bug report
- [ ] feature request

Versions.

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

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.

This issue has been already raised (#7226) and closed but commits referenced there don't solve the problem (I updated Angular CLI to 1.4.2 and Angular to 4.4.2) - source maps are still not loading for a scenario outlined above.

I also noticed that work around I supplied (#7226 (comment)) now only works for last script imported through scripts i.e.:

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

would load only source maps for anotherlib - this workaround loads both somelib and anotherlib source maps in version 1.3.2 but source maps only for last script (anotherlib) in version 1.4.x

@filipesilva filipesilva added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix labels Sep 26, 2017
@CoreyNelson
Copy link

Maybe I'm doing something wrong but I could not get https://cryptoqween.github.io/streamer/ccc-streamer-utilities.js file to load using the angular-cli.json scripts. I had to put a <script> tag in my index.html file. :(
@angular/cli: 1.1.1
node: 6.11.0
os: win32 x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.1.1
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6

@filipesilva
Copy link
Contributor

Thanks for reporting this issue. This issue was originally reported a long time ago and since then we've had many releases, one of which might have addressed this problem. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@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 Nov 1, 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

3 participants