Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thomasmost/mre-storybook-rollup
Minimum reproduction of an import bug with storybook and commonjs modules
https://github.com/thomasmost/mre-storybook-rollup
Last synced: about 1 month ago
JSON representation
Minimum reproduction of an import bug with storybook and commonjs modules
- Host: GitHub
- URL: https://github.com/thomasmost/mre-storybook-rollup
- Owner: thomasmost
- Created: 2024-08-07T02:08:24.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-08-07T02:11:01.000Z (3 months ago)
- Last Synced: 2024-08-07T06:27:51.398Z (3 months ago)
- Language: MDX
- Size: 849 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Minimum reproduceable example of Storybook bug with CommonJS exports?
I'm trying to use Storybook with a react component library bundled with CSS. The component is imported into a regular website at localhost:3000 and displays fine, but the Storybook preview errors with `The requested module '/@fs/Users/{user}/mre/packages/react/dist/index.js' does not provide an export named 'MyComponent'`
## Steps to reproduce
1. Clone this repo
2. Run `pnpm install`
3. Then `pnpm run dev`
4. Navigate to http://localhost:3000 and see the component ("Hello Storybook!")
5. Navigate to http://localhost:6006 and select MyComponent to see the error aboveNote that in dist/index.js there is this line, which sure looks like an export to me.
```js
exports.MyComponent = MyComponent;
```