Skip to content

Next.js-Vite: Bump vite-plugin-storybook-nextjs to ^3.3.0#34838

Merged
valentinpalkovic merged 2 commits into
storybookjs:nextfrom
yatishgoel:fix/nextjs-vite-bump-plugin-3.3.0
May 20, 2026
Merged

Next.js-Vite: Bump vite-plugin-storybook-nextjs to ^3.3.0#34838
valentinpalkovic merged 2 commits into
storybookjs:nextfrom
yatishgoel:fix/nextjs-vite-bump-plugin-3.3.0

Conversation

@yatishgoel
Copy link
Copy Markdown
Contributor

@yatishgoel yatishgoel commented May 19, 2026

Closes #34778

What I did

Fixed a regression where stories and docs pages using next/image threw Element 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-vite with Next.js 16 + Vite 8 + pnpm. This broke the auto-generated "Configure your project" docs page that pnpm create storybook@latest ships 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 with NextImageNamespace.default === { __esModule: true, default: <Image>, getImageProps } (the CJS exports object) instead of the Image component itself. The MockedNextImage wrapper 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 __esModule object before rendering. The previous ^3.2.4 range in @storybook/nextjs-vite permitted 3.3.0, but pnpm 11's default minimumReleaseAge silently 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.0 forces resolution to the fixed version regardless of the maturity gate.

Changes:

  • Bumped vite-plugin-storybook-nextjs from ^3.2.4 to ^3.3.0 in code/frameworks/nextjs-vite/package.json
  • Updated yarn.lock to resolve vite-plugin-storybook-nextjs@npm:3.3.0

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

  1. pnpm create storybook@latest in a fresh Next.js 16 project (or reproduce with the exact package.json from the issue)
  2. Run pnpm storybook
  3. Open the auto-generated "Configure your project" docs page
  4. Before the fix: page renders the Storybook error overlay with "Element type is invalid... Check the render method of NextImage."
  5. After the fix: page renders cleanly with all images visible
  6. Also verify a plain <Image src="..." /> story renders without console errors

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts
  • Make sure this PR contains one of the labels below: bug, 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/core team 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

  • Chores
    • Updated vite-plugin-storybook-nextjs dependency to version 3.3.0.

Review Change Stack

  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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 68fd128c-8283-4b4d-bf73-eb12cd4da526

📥 Commits

Reviewing files that changed from the base of the PR and between b15652a and 87b5214.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (1)
  • code/frameworks/nextjs-vite/package.json

📝 Walkthrough

Walkthrough

The vite-plugin-storybook-nextjs dependency version constraint is bumped from ^3.2.4 to ^3.3.0 in the Next.js + Vite framework package configuration file.

Changes

Dependency Update

Layer / File(s) Summary
vite-plugin-storybook-nextjs version constraint update
code/frameworks/nextjs-vite/package.json
Dependency version constraint for vite-plugin-storybook-nextjs is updated from ^3.2.4 to ^3.3.0.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs


Comment @coderabbitai help to get the list of available commands and usage tips.

@valentinpalkovic valentinpalkovic changed the title Next.js Vite: Bump vite-plugin-storybook-nextjs to ^3.3.0 Next.js-Vite: Bump vite-plugin-storybook-nextjs to ^3.3.0 May 20, 2026
@valentinpalkovic valentinpalkovic merged commit 8d9719c into storybookjs:next May 20, 2026
133 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Core Team Projects May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Bug]: Check the render method of NextImage.

2 participants