-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
React new JSX transform doesn't work with custom addons on 6.1.10 #13421
Comments
I'm also facing this issue. All the tutorials on how to create an addon use react hooks and they aren't actually working at all with addons. |
Storybook doesn't use the JSX transform yet, so you just need to |
I tried that and if I put |
I tried it in your repo and it worked for me @aizerin. I believe I had to add it to two files. |
I ran into this where my addon reuses components from my main source tree, so I'd rather not be forced into This workaround seems to be working for me in
|
I tried @agriffis 's code on Storybook 6.3.12 and still get If I look at the js that Storybook generated, it still includes Edit: So I figured this out; I wanted to webpack my own stories with the new JSX engine, which meant I needed to modify the webpack config using |
This is fixed in storybook 7.0 beta |
Describe the bug
I tried to use new JSX transform in my project and it works with normal code, but it fails in addons. I created MWE: https://github.com/aizerin/sb-addon-react-bug and basically, it just contains plain CRA and SB with one custom addon located here: https://github.com/aizerin/sb-addon-react-bug/tree/master/.storybook/addon
ERR! Runtime error! Check your browser console.
ERR! ReferenceError: React is not defined
To Reproduce
yarn
Expected behavior
SB will start
System
System:
OS: macOS 11.0.1
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Binaries:
Node: 14.15.1 - ~/.nvm/versions/node/v14.15.1/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.15.1/bin/npm
Browsers:
Chrome: 87.0.4280.88
Firefox: 81.0
Safari: 14.0.1
npmPackages:
@storybook/addon-actions: ^6.1.10 => 6.1.10
@storybook/addon-essentials: ^6.1.10 => 6.1.10
@storybook/addon-links: ^6.1.10 => 6.1.10
@storybook/node-logger: ^6.1.10 => 6.1.10
@storybook/preset-create-react-app: ^3.1.5 => 3.1.5
@storybook/react: ^6.1.10 => 6.1.10
The text was updated successfully, but these errors were encountered: