Skip to content

@typescript/vfs is not Node.js 25 compatible (localStorage.getItem is not a function) #3449

@yamcodes

Description

@yamcodes

Issue: @typescript/vfs fails in Node.js 25 due to changes in Web Storage implementation. Node.js 25 enabled Web Storage by default, but the package assumes it's running in a browser environment and directly calls localStorage.getItem("DEBUG") without checking if localStorage is properly available. This causes a "localStorage.getItem is not a function" error when the Web Storage API is enabled but not fully implemented. The issue affects all packages that depend on @typescript/vfs, including twoslash, @shikijs/twoslash, fumadocs-twoslash, and fumadocs-mdx.

Here is an issue in fumadocs-mdx that is a direct result of this, failing dependent project's npm install due to a broken post-install script: fuma-nama/fumadocs#2456. To reproduce, simply create a Fumadocs project in Node.js 25 and observe the error. Alternatively:

Reproducible code

Environment:
Node.js 25.0.0
@typescript/vfs 1.6.1

Steps to reproduce:

  1. Install Node.js 25.0.0
  2. Create a new project with @typescript/vfs as a dependency
  3. Run any code that imports @typescript/vfs

You will see the error:

TypeError: localStorage.getItem is not a function
at Object. (/path/to/node_modules/@typescript/vfs/dist/vfs.cjs.development.js:25:64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions