Search code examples
reactjspreact

Developer Tools with Preact Script Tag?


Is it possible to use the react developer tools with Preact when loading Preact with a < script> tag?

I can see the instructions in the documentation for doing it via webpack etc. Is there a way to do it with the script tag?


Solution

  • Turns out you can. I created a script tag version of preact/debug by importing all required files inline and then importing this file as text/babel. And it worked for me.

    Code example here - https://code pen.io/sasankmukkamala/project/editor/ZyamKk

    (Dev tools will not work in the above url because the app is in an iframe. Go to https://code pen.io/sasankmukkamala/project/debug/ZyamKk to see it in action).