Skip to content

With a reviver, a module that has no default export fails with "Unsupported type" (structuredClone of a module namespace) #38

Closed

Description

@Shinrai

Problem

When a reviver is passed and the loaded module has no default export, wisp falls back to the module namespace object and passes it through structuredClone. A module namespace can't be structured-cloned, so the call throws. That error gets caught and reported as wisp's generic "Unsupported type" error, which hides the real cause and fails a load that should either work or give a clear error.

Found while porting the suite to vitest-runner (#37). The new tests pin the current behaviour.

Fix

Decide the contract for a module without a default export when a reviver is given:

  • either apply the reviver to a plain-object copy of the namespace's own enumerable properties ({ ...ns }) rather than structuredClone(ns),
  • or throw a clear error saying a reviver needs a JSON value or a default export.

Then update the pinned test to the intended behaviour, for both wisp and wispSync where applicable.

Activity

  1. added
    type: bug
    priority: low
    status: confirmed
    area: core
    on Oct 4, 2026
  2. added a commit that references this issue on Oct 4, 2026
    e944f48
  3. added
    status: implemented
    and removed
    status: confirmed
    on Oct 4, 2026
  4. cldmv-bot commented on Oct 4, 2026

    @cldmv-bot
    Contributor

    Marked status: implemented — resolved by #41, merged into next. This issue closes automatically when that work ships to the default branch.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corepriority: lowstatus: implementedtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions