Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If I add the "async" attribute to the <script> that loads react-scan, the console logs an error #153

Open
Traveller23 opened this issue Dec 19, 2024 · 2 comments
Assignees

Comments

@Traveller23
Copy link

This is my entry file (layout.tsx):

...
    return (
        <html lang={locale}>
            <head>
                <script src="https://unpkg.com/react-scan/dist/auto.global.js" async />
            </head>
...

The error is:
image

It does report an error, but it doesn't seem to affect the functionality.
And, after removing "async", the error disappears.

Environment: next.js 14.2.20, app router.

@Traveller23 Traveller23 changed the title If I add the "async: attribute to the <script> that loads react-scan, the console logs an error If I add the "async" attribute to the <script> that loads react-scan, the console logs an error Dec 19, 2024
@lxsmnsyc
Copy link
Collaborator

with async, the main bundle would load first I assume, which leads to this error (because we require that react-scan run first before React itself).

@aidenybai aidenybai self-assigned this Dec 22, 2024
@aidenybai
Copy link
Owner

personal note: install-hook docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants