Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

358
Views
JavaScript React hiding source files in sources tab

I have recently developed a website, it's NodeJs (on Ubuntu) and running a React app. The problem is, for example, on Chrome; when you right-click on the website and check sources you can see the source codes and all the files. I want to hide all of them.

In this section, I want to hide the source codes (files) in the server. enter image description here

I tried couple of solutions on the internet but none of them worked.

For example,

I've added "build": "GENERATE_SOURCEMAP=false react-scripts build", in package.json and then I did run pm2 reload (also yarn build etc)

I've created a file called .env and added this line GENERATE_SOURCEMAP=false in it.

None of them has worked. My website is currently active right now and I want to hide source files, how can I hide these source files from sources tab so people can't see the source codes?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

After long research, I have found the solution.

  1. Create a file called .env in your project. The name of the file is just .env.
  2. In that .env file put this line GENERATE_SOURCEMAP=false and save.
  3. Then, run npm run build or yarn build.
  4. This will generate a build folder for production. After that, depends on what you are using, run this build file for running the website. For example, I'm using pm2 on my Ubuntu server, so I've used pm2 serve build 3000 --spa (my website is running on port 3000) Also be careful you are in the same path with the build folder.

That's it. Now all the source code files are gone and website works like a charm.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!