Skip to content
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

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

Closed
adamlubek opened this issue Aug 1, 2017 · 4 comments · Fixed by #7279
Closed

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

adamlubek opened this issue Aug 1, 2017 · 4 comments · Fixed by #7279
Assignees
Labels
needs: investigation Requires some digging to determine if action is needed 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 Aug 1, 2017

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.

@filipesilva filipesilva self-assigned this Aug 2, 2017
@filipesilva filipesilva added needs: investigation Requires some digging to determine if action is needed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix labels Aug 2, 2017
@alastair-todd
Copy link

+1

@alastair-todd
Copy link

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.

@adamlubek
Copy link
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

filipesilva added a commit to filipesilva/angular-cli that referenced this issue Aug 15, 2017
Adds sourcemap and minification to javascript added via the `scripts` array in `.angular-cli.json`.

`script-loader` is no longer used, which should help with CSP since it used `eval`.

Scripts will no longer appear in the console output for `ng build`, as they are now assets instead of webpack entry points.

It's no longer possible to have the `output` property of both a `scripts` and a `styles` entry pointing to the same file. This wasn't officially supported or listed in the docs, but used to be possible.

Fix angular#2796
Fix angular#7226
Fix angular#7290

Related to angular#6872
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Aug 16, 2017
Adds sourcemap and minification to javascript added via the `scripts` array in `.angular-cli.json`.

`script-loader` is no longer used, which should help with CSP since it used `eval`.

Scripts will no longer appear in the console output for `ng build`, as they are now assets instead of webpack entry points.

It's no longer possible to have the `output` property of both a `scripts` and a `styles` entry pointing to the same file. This wasn't officially supported or listed in the docs, but used to be possible.

Fix angular#2796
Fix angular#7226
Fix angular#7290

Related to angular#6872
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Aug 17, 2017
Adds sourcemap and minification to javascript added via the `scripts` array in `.angular-cli.json`.

`script-loader` is no longer used, which should help with CSP since it used `eval`.

Scripts will no longer appear in the console output for `ng build`, as they are now assets instead of webpack entry points.

It's no longer possible to have the `output` property of both a `scripts` and a `styles` entry pointing to the same file. This wasn't officially supported or listed in the docs, but used to be possible.

Fix angular#2796
Fix angular#7226
Fix angular#7290

Related to angular#6872
Brocco pushed a commit that referenced this issue Aug 17, 2017
Adds sourcemap and minification to javascript added via the `scripts` array in `.angular-cli.json`.

`script-loader` is no longer used, which should help with CSP since it used `eval`.

Scripts will no longer appear in the console output for `ng build`, as they are now assets instead of webpack entry points.

It's no longer possible to have the `output` property of both a `scripts` and a `styles` entry pointing to the same file. This wasn't officially supported or listed in the docs, but used to be possible.

Fix #2796
Fix #7226
Fix #7290

Related to #6872
dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018
Adds sourcemap and minification to javascript added via the `scripts` array in `.angular-cli.json`.

`script-loader` is no longer used, which should help with CSP since it used `eval`.

Scripts will no longer appear in the console output for `ng build`, as they are now assets instead of webpack entry points.

It's no longer possible to have the `output` property of both a `scripts` and a `styles` entry pointing to the same file. This wasn't officially supported or listed in the docs, but used to be possible.

Fix angular#2796
Fix angular#7226
Fix angular#7290

Related to angular#6872
@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 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: investigation Requires some digging to determine if action is needed 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

Successfully merging a pull request may close this issue.

3 participants