-
-
Notifications
You must be signed in to change notification settings - Fork 141
Add an option to remove devtools from production #440
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I wasn't able to reproduce it. It does not have |
Try this on a new tab! with the tagwithout the tag |
|
So it seems setting This just hides it and isn't a security hole though. Users can easily bypass it. You can use a config like this to achieve it. import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig(({ command }) => ({
plugins: [react()],
define:
command === 'build'
? {
__REACT_DEVTOOLS_GLOBAL_HOOK__: { isDisabled: true },
}
: {},
})); |
I'm going to close as not planned. This seems quite a niche need and is quite easy to do already as @sapphi-red showed. |
Related plugins
plugin-react
plugin-react-swc
Description
React developer tool works also in production by default...
It might be a security hole!
Suggested solution
Might the vite plugin inject this code on index.html as said in this thread?
Alternative
We can inject manually the script tag in our main.html file:
A good idea might be documenting it.
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: