-
Notifications
You must be signed in to change notification settings - Fork 97
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
Uncaught reference error: global is not defined #62
Comments
I'm getting this error too, which is strange because the typeof check should be working to guard against this. 🤔 Edit: my case was actually not from this library, but a library that is used by this. I have opened a PR there: donavon/use-event-listener#55 |
Same problem here. I'm also using Vite. |
I know it's a hack, but the following solves this error. I defined <script>
global = {}
</script> In <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Foo</title>
</head>
<body>
<div id="root"></div>
<!-- workaround for https://github.com/donavon/use-persisted-state/issues/62 -->
<script>
global = {}
</script>
<script type="module" src="/src/index.tsx"></script>
</body>
</html> |
I just migrated my React app from CRA to Vite and this error
use-persisted-state/src/index.js
Line 7 in 2a33963
The text was updated successfully, but these errors were encountered: