Skip to content

cloudflareDevProxyVitePlugin returns error type under NodeNext module resolution #9829

Open
@aaronadamsCA

Description

@aaronadamsCA

Reproduction

typescript-eslint playground

System Info

System:
    OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (4) x64 AMD EPYC 7763 64-Core Processor
    Memory: 8.68 GB / 15.61 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.16.0 - /usr/local/share/nvm/versions/node/v20.16.0/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 10.8.1 - /usr/local/share/nvm/versions/node/v20.16.0/bin/npm
    pnpm: 9.6.0 - /usr/local/share/nvm/versions/node/v20.16.0/bin/pnpm

Used Package Manager

pnpm

Expected Behavior

Switching TypeScript to Node16 or NodeNext module resolution should not affect the return type of cloudflareDevProxyVitePlugin.

Actual Behavior

The Plugin type returned by cloudflareDevProxyVitePlugin() doesn't exist.

What I think is happening:

  • @remix-run/dev is a CommonJS package.
  • Vite v5 ships empty CommonJS types.
  • With Node16 module resolution, TypeScript transitively resolves Vite's CJS types, where Plugin doesn't exist.

Thankfully it's easy to work around.

I'm not sure if this would get better or worse once Vite v6 goes ESM-only, but hopefully React Router v7 can ship an ESM Vite plugin before then so we won't need to find out!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions