Skip to content

Bug: default import resolves to module namespace object when bundled with Rolldown (Vite 8) #141

Description

@novym

When importing react-step-wizard as a default import in a project using Vite 8 (which uses Rolldown as its bundler), the import resolves to the entire module namespace object { default: StepWizardClass, Step: fn, __esModule: true } instead of the StepWizardClass itself. This causes a React render crash: "Element type is invalid: expected a string or class/function but got: object."

Root cause: The package's UMD bundle sets __esModule: true on its exports object and places the component on .default.
Rolldown does not use the __esModule flag to unwrap the default export the way esbuild and Rollup do.

Workaround:

import _StepWizard from 'react-step-wizard';
const StepWizard = (_StepWizard as any).default ?? _StepWizard;

Likely fix: Publishing an ESM build (with a "module" or "exports" field in package.json) would resolve this for all modern bundlers without needing a workaround.

Environment: Vite 8 / Rolldown, react-step-wizard v5.3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions