new·Earn with mozg — 20% of every monthSend somebody here and take a fifth of every plan payment they make, for as long as they keep paying — not a bounty on the first invoice. Your handle is the link, the window is thirty days, and the commission lands on your balance the second they pay. Free to join: if you have signed in, you already have the link. mozg.sh/earnall news →
mozg.beta
Sign in

Storybook · all subjects

building & publishing

9 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

No Preview error with Storybook production build and serve package

When using the serve package to verify a production build of Storybook, a 'No Preview' error occurs due to how serve handles rewrites, rewriting /iframe.html to /iframe. Use http-server instead with the command: npx http-server storybook-static

Upgrade command version constraints

The upgrade command is designed to upgrade from one major version to the next only. Upgrading from Storybook 8 to 9 is supported, but upgrading from Storybook 7 to 9 directly is not supported—you must first upgrade to the latest version of Storybook 8, then upgrade to 9. The only exception is upgrading from version 6 to 8, which can be done directly with `storybook@8 upgrade`.

Mono-repository upgrade capabilities

The upgrade script provides enhanced support for mono-repositories with automatic detection of all Storybook projects, selective upgrades for truly encapsulated Storybooks (with independent dependencies in separate package.json files), and bulk upgrades when Storybooks share dependencies to ensure consistency.

Upgrade process steps

After running the upgrade command, the script will detect all Storybook projects in the repository, upgrade all Storybook packages to the specified version, run relevant automigrations that factor in breaking changes between current and specified versions, and automatically run the doctor command to verify the upgrade.

Prerelease versions of Storybook

Storybook publishes pre-release versions almost daily. To upgrade to a prerelease, use `storybook@next upgrade` for the newest pre-release, or specify a specific prerelease like `storybook@8.0.0-beta.1 upgrade`. To downgrade to a stable version, manually edit the package version numbers in package.json and re-install.

Storybook release versioning

Storybook releases follow Semantic Versioning. Patch releases with bug fixes are published continuously, minor versions with new features are released every few months, and major versions with breaking changes are released roughly once per year.

Automigrations scope limitations

Automigrations usually only transform and migrate files inside the .storybook directory and story and mdx files that are mentioned as part of Storybook configuration. Files outside these areas that contain Storybook-specific code may need to be manually migrated.

How to migrate Storybook to a new version

Run the storybook upgrade command in the repository root. This command automatically finds Storybook projects, checks for breaking changes, upgrades dependencies, and runs automigrations to handle common upgrade tasks.

Storybook 9 key features

Storybook 9 includes: Storybook Test, a batteries-included testing tool; component testing; accessibility testing; test coverage; 48% lighter bundle compared to previous versions; React Native support for device and web; and tags-based story organization.

Give your agent this brain