Reputation: 2111
Was wondering was it possible to disable source-maps in create-react-app without having to eject. Guessing once you eject from create-react-app you can disable source-maps in webpack.
Upvotes: 3
Views: 6843
Reputation: 31
Yes. We can remove by adding a post build command like
yarn build && rm build/static/js/*.map && rm build/static/css/*.map
Upvotes: 2
Reputation: 3756
As per create-react-app doc you can create a .env file at the root of your project and add this:
GENERATE_SOURCEMAP = false
It will only remove source map for production build.
Upvotes: 1
Reputation: 34013
Prepend your build
script with GENERATE_SOURCEMAP=false
:
"build": "GENERATE_SOURCEMAP=false react-scripts build"
Upvotes: 4