angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

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

Open mhamel06 opened this issue 9 years ago • 5 comments

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/

mhamel06 avatar Aug 28 '17 18:08 mhamel06

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

cburza avatar Jun 21 '18 10:06 cburza

@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.

matt-senseye avatar Jun 21 '18 10:06 matt-senseye

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.

cburza avatar Jun 21 '18 18:06 cburza

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

anil-tf-zz avatar Jul 31 '19 05:07 anil-tf-zz

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.