uidevthing
uidevthing

Reputation: 2111

Is is possible to disable source-maps in create-react-app without having to eject

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

Answers (3)

Venky
Venky

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

Morlo Mbakop
Morlo Mbakop

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

Fellow Stranger
Fellow Stranger

Reputation: 34013

Prepend your build script with GENERATE_SOURCEMAP=false:

"build": "GENERATE_SOURCEMAP=false react-scripts build"

Upvotes: 4

Related Questions