Why is the source code displayed in the source using webpack? And how to disable it?

I use the "create-react-app-app" template to create my project, after I deployed it to the server, I find out that I can view the source code with:

Chrome > Console > Sources > webpack://

Is it possible to disable it? Thank.

enter image description here

+4
source share
1 answer
  • Extract create-react-appby runningnpm run eject
  • Open /config/webpack.config.prod.js
  • Delete or comment on line 53 containing devtool: 'source-map',
  • Build and deploy the application again

Ironically, the annotations inside /config/webpack.config.prod.jsallow the creation of source maps during the production process "slow but give good results." I'm not sure that the results are good, but this is your decision.

0

Source: https://habr.com/ru/post/1673944/


All Articles