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.

[Gatsby] React is not defined

See original GitHub issue

I was using react-facebook v8.14.0 on my Gatsby site and updated to v.9.0.5 recently. After the update I tried to build my site again and I saw the following error message.

WebpackError: ReferenceError: React is not defined

Not sure how to fix the problem and would like to see if other people saw this message.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
toburgercommented, Sep 17, 2022

I’m getting the same error in a Vite project.

1reaction
winstonmacommented, Aug 31, 2022

Hi @seeden,

Just tried v9.0.7 and I still got the error message while building my Gatsby project.

  WebpackError: ReferenceError: React is not defined

  - index.js:1 
    [.]/[react-facebook]/dist/esm/index.js:1:4045

Do you know how could I solve this problem? Thanks a lot

Read more comments on GitHub >

github_iconTop Results From Across the Web

React 17 new JSX Transform: ReferenceError: React is not ...
Gatsby 2.28.1 will throw a ReferenceError: React is not defined if React is not imported on top of the file, but the new...
Read more >
Adding gatsby-plugin-typescript to GatsbyJS "React is not ...
I created the hello world GatsbyJS application and then added the typescript plugin and I immediately got the error "React is ...
Read more >
Troubleshooting Common Errors - Gatsby
You may encounter an error like Error: ReferenceError: window is not defined that you didn't see in development if you reference browser globals...
Read more >
Gatsby - the window is not defined error, what and how to fix it?
Gatsby is a React-based framework. If the problematic code is in the component's render function, move that code into a useEffect hook or...
Read more >
Window Is Not Defined Error | ErraticGenerator.com
I used Gatsby version 4. How I solved it. I said earlier that I use react-p5-wrapper . Typically this is how I would...
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