Next.js-Vite: Bump vite-plugin-storybook-nextjs to ^3.3.0#34838
Merged
valentinpalkovic merged 2 commits intoMay 20, 2026
Merged
Conversation
Fixes a regression where stories and docs pages using next/image throw 'Element type is invalid... Check the render method of NextImage.' under Vite 8 + pnpm. Root cause is Rolldown's CJS interop change, fixed upstream in vite-plugin-storybook-nextjs@3.3.0 (PR storybookjs#117). The previous '^3.2.4' range allowed 3.3.0, but pnpm's default minimumReleaseAge silently downgrades to 3.2.5 for freshly-published versions, so users keep hitting the bug. Raising the floor to ^3.3.0 forces resolution to the fixed version. Fixes storybookjs#34778
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesDependency Update
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Comment |
valentinpalkovic
approved these changes
May 20, 2026
This was referenced May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #34778
What I did
Fixed a regression where stories and docs pages using
next/imagethrewElement type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of NextImage.under@storybook/nextjs-vitewith Next.js 16 + Vite 8 + pnpm. This broke the auto-generated "Configure your project" docs page thatpnpm create storybook@latestships in every fresh Next.js project.Root cause: Vite 8 swapped esbuild for Rolldown as the dep pre-bundler. Rolldown wraps CJS modules differently, so
import * as NextImageNamespace from "next/image"ends up withNextImageNamespace.default === { __esModule: true, default: <Image>, getImageProps }(the CJS exports object) instead of the Image component itself. TheMockedNextImagewrapper then rendered an object, triggering the React "Element type is invalid" error.The actual code fix landed upstream in
vite-plugin-storybook-nextjs@3.3.0(storybookjs/vite-plugin-storybook-nextjs#117) — it defensively unwraps the__esModuleobject before rendering. The previous^3.2.4range in@storybook/nextjs-vitepermitted 3.3.0, but pnpm 11's defaultminimumReleaseAgesilently downgrades freshly-published versions to the previous one (3.2.5), so users on pnpm keep hitting the bug. Raising the floor to^3.3.0forces resolution to the fixed version regardless of the maturity gate.Changes:
vite-plugin-storybook-nextjsfrom^3.2.4to^3.3.0incode/frameworks/nextjs-vite/package.jsonyarn.lockto resolvevite-plugin-storybook-nextjs@npm:3.3.0Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
pnpm create storybook@latestin a fresh Next.js 16 project (or reproduce with the exactpackage.jsonfrom the issue)pnpm storybook<Image src="..." />story renders without console errorsDocumentation
Checklist for Maintainers
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsbug,maintenance,dependencies,feature request,BREAKING CHANGE,other🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit