[React Scan] Failed to load. Must import React Scan before React runs.
We use the script tag version. This appears "[React Scan] Failed to load. Must import React Scan before React runs." in our Next JS App Router project.
Same here, running with npx react-scan@latest localhost:3000
It worked on the same site a few days ago 😩
Edit: For me it works with the script tag.
@henryzhang03 is react-scan not working for you at all? Or is the log there, but it still works?
@henryzhang03 is react-scan not working for you at all? Or is the log there, but it still works?
Works but log is there
Usually this is the cache (either the dev build or the browser) lagging behind, have you tried deleting the cache and/or performing hard refresh?
yupp doesnt work
Same here, running with
npx react-scan@latest localhost:3000It worked on the same site a few days ago 😩
Edit: For me it works with the script tag.
how??
@myudak oh you probably have to use react-scan's auto mode (which is basically loading react-scan from the CDN), without marking it async
Is Preact supported by react-scan? I've tried
import scanand config manually- add script tab before any other scripts
npx react-scan localhostin my Preact 'hello world' project and keep getting this error.
update: I replace Preact to React and it works fine.
Will (and when) Preact be supported?
i am receiving this error as well by using the script in Next.js App Router
for me this was fixed using a plain
<Script src="https://unpkg.com/react-scan/dist/auto.global.js" /> with the next/script in the head of my root layout.tsx.
After that change make sure to clear the cache
This works for me! Thanks @jkronlachner!
Also these can help too :) https://github.com/aidenybai/react-scan/tree/main/docs/installation