Skip to content

Add an option to remove devtools from production #440

@tiziodcaio

Description

@tiziodcaio

Related plugins

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?

<script>
window.__REACT_DEVTOOLS_GLOBAL_HOOK__&& 
(window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject=function(){})
</script>

Alternative

We can inject manually the script tag in our main.html file:

<script>
window.__REACT_DEVTOOLS_GLOBAL_HOOK__&& 
(window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject=function(){})
</script>

A good idea might be documenting it.

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions