-
-
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
CLI: Fix detection of type: module when initializing storybook #18714
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 653a9ff. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome @IanVS! Thank you so much for this fix.
I wonder if the usage of the commonJs
flag should cease to exist in Storybook 7.0.0 though. Once we merge future/base
into next
, which is planned this week, then I believe this would not be a problem anymore 🤔
Sure that makes sense, but I think 7.0 is still a ways off and it would be great to get things working for new vite storybook projects in the meantime I think. Another thing to consider is using |
Can we also add an option to CLI to generate storybook with TypeScript config: |
@ahnpnl there are plans to do just that, for the next version of SB. :) |
CLI: Fix detection of type: module when initializing storybook
Issue: storybookjs/builder-vite#441
What I did
I found that the
commonJs
option being set byinitiate
through auto-detection of the package.jsontype: module
since #16184 was not actually being used, therefore ESM projects were not being created withmain.cjs
, causing the error linked above.Vite recently changed their bootstrap to create projects with
"type": "module"
in their package.json, which brought this to light.How to test
The vite-based end-to-end tests should start to pass again.