web
web copied to clipboard
fix(dev-server-storybook): rename storybook config file
Why I did this change
I had a bug and couldn't start storybook in my package with type: module
Steps to reproduce:
- start a package with packcage.json
"type: module"(or for example clone or download https://github.com/lit/lit-element-starter-ts) - according to the current guide add the dev-server-storybook
- create a
.storybook/main.jswithexports.default =(N.B. - it's the source of issue) - create a
.storybook/server.config.mjs
- run
wds --config .storybook/server.config.mjs - got the error
ERR_REQUIRE_ESMrequire() of ES modules is not supported
What I did
So the fastest and easiest fix that works both in commonjs and module packages - rename main.js to main.cjs
- renamed hardcoded filename in
packages/dev-server-storybook/src/shared/config/readStorybookConfig.ts - changed docs and guide - rename main.js to main.cjs
🦋 Changeset detected
Latest commit: 276c50d4e6afc895b0b9fa4dc0dadbff5f868c78
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @web/dev-server-storybook | Minor |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
This is a breaking change that will break existing projects. It would be better to check if the .cjs file exists, and otherwise use the .js file.