-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
WebpackError: ReferenceError: React is not defined #27694
Comments
not sure if this could be it, but I noticed a new ["@babel/preset-react", {
"runtime": "automatic"
}] https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-cli/rollup.config.js#L60
|
I created a custom module.exports = api => {
const isTest = api.env('test');
return {
presets: [
[
'@babel/env',
{
// use ES modules for rollup and commonjs for jest
modules: isTest ? `commonjs` : false,
shippedProposals: true,
targets: {
node: '10.13.0',
},
},
],
[
'@babel/preset-react',
{
runtime: 'automatic',
},
],
],
plugins: ['@babel/plugin-transform-runtime'],
};
}; and this worked, so the problem is the setup with |
ok so I found that you disabled the feature: #27615 |
See these URLs: apparently Gatsby ecosystem has some errors that does not support the new JSX runtime by default yet. gatsbyjs/gatsby#27694 https://github.com/gatsbyjs/gatsby/pull/27615/files
See these URLs: apparently Gatsby ecosystem has some errors that does not support the new JSX runtime by default yet. gatsbyjs/gatsby#27694 https://github.com/gatsbyjs/gatsby/pull/27615/files
Description
Since update of gatsby version
^2.24.86
the errorReact is not defined
started to occur when following the new jsx transformer setup: https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#gatsbyHere is the changes since the latest working version:
https://github.com/gatsbyjs/gatsby/compare/[email protected]
Steps to reproduce
Just run a gatsby app without
import React from 'react';
in any files and run any version above2.24.85
Expected result
should work with the new jsx transform
Actual result
WebpackError: ReferenceError: React is not defined
Environment
The text was updated successfully, but these errors were encountered: