storybook: [Bug]: storybook build not working due to error from `plugin-transform-block-scoping`: `Cannot set properties of undefined (setting 'kind')`
Describe the bug
After initiating a fresh React app, and then initiating storybook and running yarn build-storybook
I get a build error:
ERR! => Failed to build the preview
ERR! Module build failed (from ./node_modules/babel-loader/lib/index.js):
ERR! TypeError: /Users/usrn/Documents/stbk-repro/src/stories/Button.stories.jsx: Cannot read properties of undefined (reading 'constantViolations')
I can reproduce this on 2 different computers.
To Reproduce
1. `npx create-react-app my-app`
2. `npx storybook init`
3. `npm run build-storybook`
System
System:
OS: macOS 12.6
CPU: (8) arm64 Apple M2
Binaries:
Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.15.0 - ~/.nvm/versions/node/v16.17.1/bin/npm
Browsers:
Chrome: 108.0.5359.124
Firefox: 107.0
Safari: 16.0
npmPackages:
@storybook/addon-actions: ^6.5.15 => 6.5.15
@storybook/addon-essentials: ^6.5.15 => 6.5.15
@storybook/addon-interactions: ^6.5.15 => 6.5.15
@storybook/addon-links: ^6.5.15 => 6.5.15
@storybook/builder-webpack5: ^6.5.15 => 6.5.15
@storybook/manager-webpack5: ^6.5.15 => 6.5.15
@storybook/node-logger: ^6.5.15 => 6.5.15
@storybook/preset-create-react-app: ^4.1.2 => 4.1.2
@storybook/react: ^6.5.15 => 6.5.15
@storybook/testing-library: ^0.0.13 => 0.0.13
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 13
- Comments: 21 (9 by maintainers)
Commits related to this issue
- try setting res according to sb issue see https://github.com/storybookjs/storybook/issues/20382#issuecomment-1363042761 — committed to redwoodjs/redwood by jtoar 2 years ago
Note I’ve found that we can add the following to the
overrides
orresolutions
field to ourpackage.json
file which will resolve the issue, for now:v7.20.5 is the latest version which appears to work properly.
@neogeek thank you for that information, anything might help. I posted all info I have here: https://github.com/babel/babel/issues/15300
Hopefully it can be quickly resolved by the babel team.
@emiliosheinz Yep, if you’re using yarn you need to use
resolutions
. Glad it could help you–I wasted an hour earlier trying to figure out the issue.Yay!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.14 containing PR #20386 that references this issue. Upgrade today to the
@next
NPM tag to try it out!Closing this issue. Please re-open if you think there’s still more to do.
@cjones26 I didn’t know it, my bad! Thank you for the help.
Thank you for posting your work-around @cjones26 👏 I wish I could upvote it twice
Looks like they are already working on a solve https://github.com/storybookjs/storybook/pull/20383