forked from vitejs/vite
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Describe the bug
When using rolldown-vite with Storybook v10 and @storybook/addon-docs, the built Storybook fails at runtime with ReferenceError: __STORYBOOK_MODULE_*__ is not defined.
What I expect: Built Storybook loads without errors, same as with standard Vite.
What actually happens: Console errors on page load:
Uncaught ReferenceError: __STORYBOOK_MODULE_CORE_EVENTS_PREVIEW_ERRORS__ is not defined
at csf-BrJoaeT2.js:4:13387
or
Uncaught ReferenceError: __STORYBOOK_MODULE_CLIENT_LOGGER__ is not defined
at instrumenter-LwmSDSR-.js:48:53
Observations:
- Only affects built Storybook (dev mode works fine)
- Only happens when
@storybook/addon-docsis enabled (other addons work fine). Might not be related to this addon speicifically, since another smaller repo with it works, but I guess it happens in some cases due to chunking/code splitting. - Standard Vite does NOT have this issue - only rolldown-vite
- I noticed a
csf-*.jschunk (~149KB) appears in rolldown-vite builds but not in standard Vite builds - this might be related to differences in code splitting behavior
Reproduction
https://github.com/bengry/rolldown-vite-storybook-globals-bug
Steps to reproduce
-
Clone the repo and install:
git clone https://github.com/bengry/rolldown-vite-storybook-globals-bug cd rolldown-vite-storybook-globals-bug yarn install -
Build Storybook:
yarn build-storybook
-
Serve the built output:
npx serve ./apps/storybook/storybook-static
-
Open browser and check devtools console - you'll see the ReferenceError
System Info
System:
OS: macOS 26.1
CPU: (16) arm64 Apple M3 Max
Memory: 494.23 MB / 64.00 GB
Shell: 4.2.1 - /opt/homebrew/bin/fish
Binaries:
Node: 24.10.0
Yarn: 4.12.0
npm: 11.7.0
Browsers:
Chrome: 143.0.7499.110
Safari: 26.1
npmPackages:
@vitejs/plugin-react: ^5.1.2 => 5.1.2
rolldown-vite: 7.2.11
Used Package Manager
yarn
Logs
Click to expand!
# Build output shows csf chunk:
storybook-static/assets/csf-BrJoaeT2.js 149.02 kB │ gzip: 46.82 kB
# Browser console error:
Uncaught ReferenceError: __STORYBOOK_MODULE_CORE_EVENTS_PREVIEW_ERRORS__ is not defined
at csf-BrJoaeT2.js:4:13387Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
No labels