Skip to content

fix: support Next.js 16.3.0 - #144

Closed
Stanzilla wants to merge 2 commits into
storybookjs:mainfrom
Stanzilla:b.staneck/fix-next-16-3-storybook-ci
Closed

Stanzilla wants to merge 2 commits into
storybookjs:mainfrom
Stanzilla:b.staneck/fix-next-16-3-storybook-ci

Conversation

@Stanzilla

@Stanzilla Stanzilla commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • update the example and development dependencies from Next.js 16.3 preview to 16.3.0
  • recover when Next.js returns a raw config module from its config cache
  • keep one compiled React package instance during Vitest dependency pre-bundling
  • cover the config-cache failure with a real repeated-load regression test

Root cause

The Rust React Compiler fallback loads next.config with rawConfig: true. Next.js 16.3.0 stores that raw module under the same cache key as a normal config load. A later Storybook project can receive the raw module without Next.js defaults. loadJsConfig then fails while it reads config.experimental.useTypeScriptCli.

The final release also gives the root package and example app separate Next.js peer snapshots. Vitest could pre-bundle two private compiled React copies, which caused invalid hook calls.

This change normalizes a cached raw config through the existing guarded fallback. It also aliases the private compiled React package directories so Vitest uses one instance.

Follow-up to #134.

Validation

  • pnpm check
  • pnpm build
  • pnpm exec vitest run src/utils/next-config.integration.test.ts src/utils/next-config.test.ts src/index.test.ts src/plugins/next-swc/plugin.test.ts (9 tests)
  • pnpm --dir example test:all --run (47 tests)
  • NODE_OPTIONS=--unhandled-rejections=strict pnpm --dir example build-storybook

@Stanzilla
Stanzilla marked this pull request as ready for review August 9, 2026 19:15
Comment thread package.json
Comment on lines 89 to +117
@@ -100,7 +100,7 @@
},
"packageManager": "pnpm@10.28.2",
"dependencies": {
"@next/env": "16.3.0-preview.5",
"@next/env": "16.3.0",
"image-size": "^2.0.0",
"magic-string": "^0.30.11",
"module-alias": "^2.2.3",
@@ -114,7 +114,7 @@
"pnpm": {
"overrides": {
"vite-plugin-storybook-nextjs": "workspace:*",
"next": "16.3.0-preview.5"
"next": "16.3.0"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should these be ^?

@ndelangen

Copy link
Copy Markdown
Member

Closing in favor of the monorepo port: storybookjs/storybook#35882

This repository has moved into the Storybook monorepo — see #145.

@ndelangen ndelangen closed this Aug 13, 2026
@Stanzilla

Copy link
Copy Markdown
Contributor Author

Oh neat, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants