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

Add option for hidden-source-map to use with ng build --prod #7527

Closed
mhamel06 opened this issue Aug 28, 2017 · 5 comments · Fixed by #13062
Closed

Add option for hidden-source-map to use with ng build --prod #7527

mhamel06 opened this issue Aug 28, 2017 · 5 comments · Fixed by #13062
Labels
feature Issue that requests a new feature P5 The team acknowledges the request but does not plan to address it, it remains open for discussion

Comments

@mhamel06
Copy link
Contributor

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions.

1.4.0-rc2

Repro steps.

Feature

The log given by the failure.

Feature

Desired functionality.

Add an option to generate hidden source maps for production builds. Hidden source maps are helpful because they are full source maps, but not referenced in the minified files. This allows a developer to use the source maps for debugging purposes without letting the browser know they exist. Error tracking sites such as Atatus allow users to upload source maps manually so the stack traces are more useful and the maps never need to be made public.

In my case, I have modified my fork of the cli to generate hidden source maps when using the production build and source-maps=true. This has worked for me, but I didn't expect it would be the best fit for the whole project.

devtool: buildOptions.sourcemaps ? 'hidden-source-map' : false,

https://github.com/mhamel06/angular-cli/blob/2f551150bccdeb6121c79f0b1fd65bfdd68c33ce/packages/%40angular/cli/models/webpack-configs/production.ts#L108-L110

Mention any other details that might be useful.

https://webpack.js.org/configuration/devtool/

@filipesilva filipesilva added P5 The team acknowledges the request but does not plan to address it, it remains open for discussion feature Issue that requests a new feature labels Sep 4, 2017
@hansl hansl removed their assignment Feb 6, 2018
@cburza
Copy link

cburza commented Jun 21, 2018

Any update on this? I have no way of doing builds with hidden source maps so I can upload them to sentry.io.

@matt-senseye
Copy link

@cburger - if it's helpful, as a workaround what we do is have a script in package.json which runs ng build then immediately moves the sourcemaps out of dist and into a separate sourcemaps folder. This allows us to upload them to Sentry without including them in the app deployment. It'd be better if they were proper hidden sourcemaps, but it gets us most of the way there.

@cburza
Copy link

cburza commented Jun 21, 2018

Thank you @matt-senseye . Yes, this is pretty much what I am doing at the moment. I exclude the mappings when I do the rsync to the server. Angular just keeps throwing a warning in the console because it can't find the mappings. Would be better to do the build correctly. Another solution would have been to escape Angular CLI to edit the Webpack config, but that is also no longer supported.

vikerman pushed a commit that referenced this issue Nov 30, 2018
…ps (#13062)

* feat(@angular/cli): update schema to match new `sourceMap`

* feat(@angular-devkit/build-angular): fine grain settings for sourceMaps

This PR add more control over which sourceMaps you want, Now you can enable sourceMaps for scripts only, styles only or both. Also we added another functionality which are hidden sourcemaps. These are normaly used for error reporting tools.

Fixes #7527
@anil-tf-zz
Copy link

anil-tf-zz commented Jul 31, 2019

Is there an example of this somewhere? How to use the fine grain settings (e.g. hidden) via commandline?
ng build --prod --hidden-source-map

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Issue that requests a new feature P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants