nitrojs / nitrojs/nitro

Uncaught TypeError: inherits4 is not a function in Nitro v3 with @react-pdf/renderer

Open
#3,666 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug v3
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Environment
  • nitro-nightly@3.0.1 or nitro@3.0.1-alpha.0 (I tried with both)
  • node v22
  • vite v7
  • react v19
Reproduction

https://github.com/Yanis02015/nitro-react-ssr. I used the react-ssr example from the vite-examples repo

To reproduce without the repo that I shared

  1. Install @react-pdf/renderer
  2. use this template anywhere on the client side
  3. And the client will crash, the hydration will break
import { Document } from "@react-pdf/renderer";

const PDF = () => <Document />;

// or

console.log(Document)
Describe the bug

The @react-pdf/renderer package produces the error Uncaught TypeError: inherits4 is not a function when used in client-side react.

I first had this bug on Stack Start, after they moved to V3, and so in V2 I didn't have this bug.

Additional context

No response

Logs
Uncaught TypeError: inherits4 is not a function
    at node_modules/.pnpm/queue@6.0.2/node_modules/queue/index.js (@react-pdf_renderer.js?v=edf0c095:434:5)
    at __require2 (chunk-PLDDJCW6.js?v=edf0c095:17:50)
    at @react-pdf_renderer.js?v=edf0c095:16960:28

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the linked nitro-react-ssr repository and the vite-examples react-ssr example using Nitro v3, then inspect the bundled queue entry at node_modules/.pnpm/queue@6.0.2/node_modules/queue/index.js and the surrounding @react-pdf/renderer bundle. Done means the client can import or render Document and complete hydration without the inherits4 TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, react, typescript, vite
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.