-
-
Notifications
You must be signed in to change notification settings - Fork 27k
[v4]ReferenceError: React is not defined #9882
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
Comments
I have submitted PR #9885 to fix this. This is because the jsx-runtime configuration gets removed webpack config during the ejection process. In the meantime, Adding a runtime option to babel in // package.json
{
"babel": {
"presets": [
[
"react-app",
{
"runtime": "automatic"
}
]
]
}
} or add presents option back to // webpack.config.js
{
loader: require.resolve('babel-loader'),
options: {
customize: require.resolve(
'babel-preset-react-app/webpack-overrides'
),
// Add this back
presets: [
[
require.resolve('babel-preset-react-app'),
{
runtime: hasJsxRuntime ? 'automatic' : 'classic',
},
],
],
}
} |
Thank you @n3tr! Changing the webpack config as you suggested worked for me. |
Thanks, only
I then just copied my source files over. |
npx create-react-app my-app
then eject it, it report
React is not defined
The text was updated successfully, but these errors were encountered: