Is it possible to hide constant variable from browser dev tools in react js without using .env

114 Views Asked by At

Is it possible to hide constant variables in react js ... I have used .env file but after the 'npm run build' constants mentioned in .env visible in dev tools->source section

Is any other method or way is there to hide constant from dev tools?

I have tried with .env & ignore it from git by mentioning .env in .gitignore.

But after npm run build & using obfuscation in react; constant variables are still visible when try to get details from developer tools -> Source.

1

There are 1 best solutions below

1
Emanuel Friedrich On

No.

It's just the idea of ​​javascript: code executed by the client, the client must know what is being executed