Nx provides migration support for major Storybook versions (8, 9, and 10). You can upgrade using Nx's built-in migration system or the Storybook CLI directly.
Upgrading with Nx
Section titled “Upgrading with Nx”You can run a migration generator for the specific Storybook version you want to upgrade to, or starting with Nx 22, run nx migrate to automatically upgrade to Storybook 10.
Using migration generators
Section titled “Using migration generators”Run the Storybook migration generator for your target version:
| Generator | Command | Description |
|---|---|---|
| migrate-8 | nx g @nx/storybook:migrate-8 | Migrate to Storybook 8 |
| migrate-9 | nx g @nx/storybook:migrate-9 | Migrate to Storybook 9 |
| migrate-10 | nx g @nx/storybook:migrate-10 | Migrate to Storybook 10 |
Using nx migrate (Nx 22+)
Section titled “Using nx migrate (Nx 22+)”Starting with Nx 22, when you run nx migrate, Nx automatically migrates Storybook 9 to Storybook 10. If you're already on Storybook 10, no migration runs. If you're on Storybook 8 or earlier, you'll need to use the migration generators above first.
nx migrate latestnx migrate --run-migrationsAI-assisted migrations
Section titled “AI-assisted migrations”For Storybook 10, some changes cannot be fully automated. When this happens, Nx generates an instructions file at ai-migrations/MIGRATE_STORYBOOK_10.md that an AI agent (Claude, ChatGPT, GitHub Copilot, etc.) can use to complete the migration.
For example, Storybook 10 requires configuration files to use ESM syntax instead of CommonJS. The AI migration instructions guide an agent to find and convert any CJS Storybook configs to ESM format.
Upgrading with Storybook CLI
Section titled “Upgrading with Storybook CLI”If you prefer to skip Nx migrations and use the Storybook CLI directly:
npx storybook@latest upgradeThis runs Storybook's own upgrade command which updates dependencies and configuration files. See the Storybook upgrade documentation for more details.
After upgrading
Section titled “After upgrading”- Review breaking changes in the Storybook release notes
- Update your stories to use new APIs if needed
- Test your Storybook instances to ensure everything works
- Update any custom configurations or addons
Troubleshooting
Section titled “Troubleshooting”If you encounter issues:
- Check the Storybook migration guide for framework-specific changes
- Review the Nx Storybook documentation
- Report issues on the Nx GitHub or Storybook GitHub