Skip to content

Exclude sourcemaps from production build #2742

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
wants to merge 1 commit into from
Closed

Exclude sourcemaps from production build #2742

wants to merge 1 commit into from

Conversation

seklyza
Copy link

@seklyza seklyza commented Jul 7, 2017

In my opinion, sourcemaps in production aren't useful. People can get access to the source code.
In my projects, I don't want/need sourcemaps in production and every time I need to eject because it is not useful to exclude the sourcemaps files from the build folder. I think it might be a good idea to exclude them automatically from webpack.config.prod.js.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@reznord
Copy link

reznord commented Jul 7, 2017

I think it is better to leave the option of disabling the source-maps in the userland itself. If he really doesn't want the source-maps, then he can delete the .map file from the build folder.

@gaearon
Copy link
Contributor

gaearon commented Jul 7, 2017

We intentionally include them. They are very useful for debugging production code, and for error reporting (e.g. Sentry).

If you don’t like shipping them, just delete them as a post build step. You don't need to eject to do this. Something like this could work:

"scripts": {
  "build": "react-scripts build && rm build/static/js/*.map"

I would still suggest to move them somewhere private rather than deleting so that you can use them for analyzing production errors.

@kachkaev
Copy link

Probably "build": "react-scripts build && rm build/static/**/*.map" is slightly better, because it also removes build/static/css/main.abcdef.css.map.

@hugomosh
Copy link

hugomosh commented Feb 2, 2018

@gaearon can you point me in the direction on how to make them private for analyzing production errors?

@Timer
Copy link
Contributor

Timer commented Feb 4, 2018

@hugomosh just don't deploy them 😄

@facebook facebook locked and limited conversation to collaborators Feb 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants