Thanks so much!!!
You can delete .js.map
files from build/static/js
as a deployment step if you prefer so.
I think it could be very useful to have a build:dev script if you want to use sourcemps, who wants to make a build for production with sourcemaps? I think its very strange.
Now I have a script to delete the sourcemaps and also revoming sourcemaps comments in main.js and main.css in order to avoid browser dispathing "source map not found" warning. I find this solution very dirty.
who wants to make a build for production with sourcemaps? I think its very strange.
I wouldn't say so. They are super useful for error reporting for example, as well as for analysing bundle size from dependencies. Whether you choose to deploy them or not is your choice, but producing them is useful.
There's an ongoing discussion in https://github.com/facebookincubator/create-react-app/issues/1341 so feel free to track it. I'm open to other solutions so please suggest them there.
Thanks @gaearon , I continue the discussion there :)
For those coming here from google:
cross-env GENERATE_SOURCEMAP=false npm run build
In a Vue.js project using Webpack see the ./config folder on the index.js file. Change the line:
productionSourceMap: true
to
productionSourceMap: false
This works for me. Hope it help anyone.
// package.json
"build": "react-scripts build",
"postbuild": "rimraf build/**/*.map"
This way, it will auto delete map files during build generation.
Most helpful comment
For those coming here from google:
cross-env GENERATE_SOURCEMAP=false npm run build