Reputation: 323
I recently created a small website with react app , but after running , npm run build
in the browser i find static folder in the browser in debugger , with my whole react app , components and app.js even node_modules , and of course i think , there is something wrong with npm run build , because , this is not how it suppose to work , by the way i'm using nginx and pm2 to connect my back-end to the website , both on the same server to deploy my website , so the question here , is the error here in nginx configuration or on react build script.
Upvotes: 0
Views: 1536
Reputation: 983
Create React App, give you a webpack configuration that by default include the option to include the source on the build.
You need to do this:
1. Eject your create-react-app project by running npm run eject
:
2. Open your /config/webpack.config.prod.js
.
3. Remove the line who contains the devtool: 'source-map'
.
4. Build, and deploy your app again.
With this, you should don't have the source on your browser, check this if you need more information of webpack config: https://webpack.js.org/configuration/devtool/
NOTE: If you don't wanna eject your code, you can use rewire, and don't touch the base code of CRA and instead override with your configuration.
Hope this helps you!
Upvotes: 1