Skip to content

RSC: Internal server error: (0 , html_dom_parser_1.default) is not a function #1072

@silvenon

Description

@silvenon

Related plugins

Describe the bug

Hello. I'm using Vite v8 in my project, and I'm gradually migrating to RSC, very exciting! I stumbled upon an interop bug with a transitive depenency of html-react-parser called html-dom-parser, and it happens only when I add the plugin, but only during development! It builds fine, so something is tripping up the module runner:

[vite] Internal server error: (0 , html_dom_parser_1.default) is not a function
      at HTMLReactParser (/Users/silvenon/Code/my-rsc-rewrite/node_modules/.pnpm/html-react-parser@5.2.11_@types+react@19.2.8_react@19.2.3/node_modules/html-react-parser/src/index.ts:35:14)

This is the only dependency I've had issues with so far related to the RSC plugin, but I also didn't get far in my migration success to try out all of my modules. Regarding my situation I managed to find a workaround — fortunately html-react-parser exports html-dom-parser primitives, so I was able to use those to achieve my goal.

The attached repro is not minimal, but it should be familiar to the maintainers because it's created from your starter example. The only thing I added is an additional call to the parse function in the SSR entry point to create the development error.

Reproduction

https://github.com/silvenon/repro/tree/vite-rsc-ssr-no-external

Steps to reproduce

# with GitHub CLI
gh repo clone silvenon/repro -b vite-rsc-ssr-no-external
cd repro
pnpm install
pnpm dev --open # error ❌
pnpm build
pnpm preview --open # works ✅

System Info

System:
    OS: macOS 26.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 459.95 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.21.0 - /Users/silvenon/.n/bin/node
    npm: 10.9.4 - /Users/silvenon/.n/bin/npm
    pnpm: 10.28.0 - /Users/silvenon/.n/bin/pnpm
    bun: 1.1.29 - /Users/silvenon/.bun/bin/bun
    Deno: 1.45.2 - /opt/homebrew/bin/deno
  Browsers:
    Chrome: 144.0.7559.60
    Safari: 26.2
  npmPackages:
    @vitejs/plugin-react: ^5.1.2 => 5.1.2 
    @vitejs/plugin-rsc: ^0.5.14 => 0.5.14 
    vite: 8.0.0-beta.5 => 8.0.0-beta.8

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions