disable-react-devtools icon indicating copy to clipboard operation
disable-react-devtools copied to clipboard

NextJS upgrade

Open brown2020 opened this issue 3 years ago • 2 comments

Thanks for adding NextJS support, but I haven't been able to get it working yet, just putting the disableReactDevTools() function in _app.js. The entire component tree is still visible with dev tools. Everything works great in React, but I haven't found a working solution yet for NextJS. Please advise on how you made it work. Thanks!

Update: I solved it by importing the code and making it into a hook that I call in _app.js

brown2020 avatar Jun 16 '22 16:06 brown2020

@bybruno, any idea ?

fvilers avatar Jun 20 '22 11:06 fvilers

try this npm i disable-devtool see the npm link

if (
        typeof window !== "undefined" &&
        typeof window.navigator !== "undefined" &&
        typeof navigator !== "undefined" &&
        navigator.userAgent
    ) {
        const disableDevtool = require("disable-devtool");
        disableDevtool();
    }

Sisableng avatar Sep 27 '23 14:09 Sisableng