"Can't find variable React" after upgrading to v8 #26982
-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
I'm randomly seeing the same thing after upgrading to v8. It happens inconsistently, e.g. sometimes it happens on one story sometimes it happens on another one. I'll try to tracking it down |
Beta Was this translation helpful? Give feedback.
-
This is still an issue btw - here is a repo for reproduction qoretechnologies/qorus-ide#15 - this is the second storybook I upgraded to v8 and the same issue happens. I tried clearing the yarn cache, updating babel, but nothing helped. |
Beta Was this translation helpful? Give feedback.
-
In Storybook 8, we don't apply any Babel presets. If you don't want to import "React" every time you use JSX, you have to set the appropriate setting to automatically include the JSX React runtime, as documented here: https://babeljs.io/docs/babel-preset-react If you use Vite and the proper React Vite plugin, the React runtime is set per default to "automatic": https://www.npmjs.com/package/@vitejs/plugin-react |
Beta Was this translation helpful? Give feedback.
So the issue is that the
babel-loader
first reads your babel configuration from yourpackage.json
and therefore ignoresbabel.config.js.
If you remove thebabel
setting in package.json, you will see, that it will process the configuration inbabel.config.js