Skip to content

refactor: upgrade Storybook 8.6 to 10.3 with webpack#17900

Merged
pettinarip merged 14 commits into
devfrom
refactor/storybook-10-upgrade-webpack
Apr 2, 2026
Merged

refactor: upgrade Storybook 8.6 to 10.3 with webpack#17900
pettinarip merged 14 commits into
devfrom
refactor/storybook-10-upgrade-webpack

Conversation

@pettinarip
Copy link
Copy Markdown
Member

@pettinarip pettinarip commented Mar 31, 2026

Summary

  • Upgrade Storybook from 8.6.17 to 10.3.3 via two-step migration (8→9→10)
  • Keep @storybook/nextjs (webpack) framework — reverted automatic vite migration
  • Update all third-party addons: storybook-next-intl 10.1.1, @chromatic-com/storybook 5.1.1, eslint-plugin-storybook 10.3.3, chromatic 16.0.0
  • Normalize 17 wildcard @storybook/react/* imports before migration for uniform codemod handling
  • Fix PhoneDecorator.tsx shared decorator import missed by automigration

Key SB9 automigrations applied

  • globalsinitialGlobals in preview config
  • @storybook/react@storybook/nextjs (renderer-to-framework)
  • Consolidated imports (@storybook/manager-apistorybook/manager-api, etc.)
  • Removed addon-essentials, addon-interactions (moved to core), added addon-docs
  • Removed deprecated docs.autodocs config

Key SB10 changes

  • ESM-only distribution (main config)
  • addon-globals-api migration for viewport/backgrounds

Test plan

  • pnpm build-storybook passes
  • pnpm build-storybook:chromatic passes
  • Storybook dev server starts and renders stories
  • Theme switching (light/dark) works
  • Locale switching works across all 5 configured locales
  • SVG icons render correctly (webpack @svgr integration)
  • Chromatic CI workflow runs successfully

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 31, 2026

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 097a282
🔍 Latest deploy log https://app.netlify.com/projects/ethereumorg/deploys/69ce5ea4c1cf8900089e8f25
😎 Deploy Preview https://deploy-preview-17900.ethereum.it
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 54 (🔴 down 1 from production)
Accessibility: 94 (no change from production)
Best Practices: 100 (no change from production)
SEO: 98 (🔴 down 1 from production)
PWA: 59 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added config ⚙️ Changes to configuration files dependencies 📦 Changes related to project dependencies documentation 📖 Change or add documentation tooling 🔧 Changes related to tooling of the project labels Mar 31, 2026
@pettinarip pettinarip changed the base branch from dev to refactor/nextjs-16-upgrade March 31, 2026 08:27
@pettinarip pettinarip marked this pull request as draft March 31, 2026 08:27
@pettinarip pettinarip marked this pull request as ready for review March 31, 2026 12:49
Copy link
Copy Markdown
Member

@wackerow wackerow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @pettinarip! I think just the import order needs tidying (linter may not catch that one but we should place the type declaration below the imports) then this should be good to go

Comment thread src/lib/md/compile.ts Outdated
Comment thread .storybook/main.ts
},

features: {
experimentalRSC: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still recognized/needed in SB10? Potential loose end, not a blocker

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base automatically changed from refactor/nextjs-16-upgrade to dev April 2, 2026 11:52
… barrel

Replace all @storybook/react/* wildcard subpath imports with
@storybook/react barrel imports across 17 files. This ensures
the SB9 automigration codemods handle all files uniformly.

Also consolidate 4 redundant @storybook/test imports in
ListenToPlayer.stories.tsx into a single import statement.
Run npx storybook@9 upgrade with automigrations:
- upgrade-storybook-related-dependencies
- initial-globals (globals → initialGlobals)
- consolidated-imports (@storybook/* → storybook/*)
- remove-addon-interactions (moved to core)
- renderer-to-framework (@storybook/react → @storybook/nextjs)
- remove-essential-addons (replaced with @storybook/addon-docs)
- remove-docs-autodocs (deprecated config removed)
The PhoneDecorator.tsx shared decorator was not updated by the
automigration because it doesn't match the .stories.tsx glob pattern.
Update @storybook/react → @storybook/nextjs to match the rest of
the codebase.
Replace require() calls with fs.readFileSync + JSON.parse for SB10
ESM-only compatibility. Uses import.meta.dirname for robust
file-relative path resolution. Removes leftover console.log debug
output.
Run npx storybook@latest upgrade with automigrations:
- addon-globals-api (viewport/backgrounds configuration)
- nextjs-to-nextjs-vite (reverted - staying on webpack per plan)

Reverted the automatic nextjs-vite migration: replaced
@storybook/nextjs-vite with @storybook/nextjs across all files
to keep the webpack-based framework as intended.
- storybook-next-intl: 1.2.5 → 10.1.1 (supports SB9/10, next-intl v3/v4)
- @chromatic-com/storybook: 1.5.0 → 5.1.1 (requires SB10)
- eslint-plugin-storybook: 0.8.0 → 10.3.3
- chromatic: 12.0.0 → 16.0.0
Update code example from @storybook/react to @storybook/nextjs
to match the new framework-based imports after the SB10 upgrade.
The previous fs.readFileSync + import.meta.dirname approach fails
because this file is bundled by webpack for the browser preview
iframe, not run in Node. import.meta.dirname is undefined in the
browser context.

Revert to require() which webpack resolves at build time. The SB10
ESM-only requirement applies to main.ts (Node-side config), not to
files bundled by webpack for the preview.
The SB10 nextjs-to-nextjs-vite automigration added vite as a direct
devDependency. Since we reverted to the webpack framework, vite is
not needed.
- Change moduleResolution from "node" to "bundler" — required because
  @storybook/nextjs v10 uses package.json exports with no main/types
  fallback fields. Also the recommended setting for Next.js 16.
- Exclude .storybook/ from Next.js type checking since it has its own
  build pipeline and its dependencies (storybook packages) should not
  be resolved during next build.
@pettinarip pettinarip force-pushed the refactor/storybook-10-upgrade-webpack branch from ee9f81a to 097a282 Compare April 2, 2026 12:18
@pettinarip pettinarip merged commit 8ce1428 into dev Apr 2, 2026
12 checks passed
@pettinarip pettinarip deleted the refactor/storybook-10-upgrade-webpack branch April 2, 2026 13:29
@pettinarip pettinarip mentioned this pull request Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config ⚙️ Changes to configuration files dependencies 📦 Changes related to project dependencies documentation 📖 Change or add documentation tooling 🔧 Changes related to tooling of the project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants