question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React is not defined

See original GitHub issue

I hope you can help me figure this one out. Everything works perfectly in dev mode, but if I build the project, I end up with React is not defined error. The issue happens when I try to import OverlayProvider from @react-aria/overlays. Not sure what exactly the problem is. Tried adding react as an alias, but it doesn’t help. Also not sure what the difference is between dev and prod config that would account for this. Any thoughts?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
hypeJunctioncommented, Jan 14, 2022

Yes, sorry. I should have done it right away. Will report back.

0reactions
bstrocommented, Feb 15, 2022

I upgraded all the dependencies in my project’s package.json and the error disappeared. I’m unblocked, but I’ve also learned nothing. On the off-chance that this is helpful information for anyone, the deps I upgraded:

-    "react-aria": "^3.12.0",
+    "react-aria": "^3.13.0",

-    "@babel/core": "^7.16.12",
+    "@babel/core": "^7.17.3",

-    "@storybook/addon-actions": "^6.5.0-alpha.30",
+    "@storybook/addon-actions": "^6.5.0-alpha.39",

-    "@storybook/addon-essentials": "^6.5.0-alpha.30",
+    "@storybook/addon-essentials": "^6.5.0-alpha.39",

-    "@storybook/addon-links": "^6.5.0-alpha.30",
+    "@storybook/addon-links": "^6.5.0-alpha.39",

-    "@storybook/react": "^6.5.0-alpha.30",
+    "@storybook/react": "^6.5.0-alpha.39",

-    "storybook-builder-vite": "^0.1.14",
+    "storybook-builder-vite": "^0.1.15",

-    "vite": "^2.7.2"
+    "vite": "^2.8.0"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught ReferenceError: React is not defined - Stack Overflow
Possible reasons are 1. you didn't load React.JS into your page, 2. you loaded it ...
Read more >
'X' is not defined react/jsx-no-undef Error in React | bobbyhadz
The React.js error "X is not defined react/jsx-no-undef" occurs when we forget to import a function, class or a variable in our code...
Read more >
Getting "Uncaught ReferenceError: react is not defined".
Hi Louie Ambriz, It's hard to tell without seeing your code but it sounds like React is not being loaded into your project....
Read more >
[v4]ReferenceError: React is not defined · Issue #9882 - GitHub
I have submitted PR #9885 to fix this. This is because the jsx-runtime configuration gets removed webpack config during the ejection process ...
Read more >
Uncaught ReferenceError: React is not defined
Hi! You don't have to import React because you're using unpkg so React and ReactDOM are already available for you :wink:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found