#3532·react-pdf

@react-pdf/font started to depend on [email protected] and triggers a TypeError: Invalid URL

Author: Lucas-CCreated Aug 26, 2026Updated Sep 10, 2026

Describe the bug Upgrading @react-pdf/font from 4.0.9 to 4.1.0 or 4.1.1 caused a TypeError: Invalid URL

To Reproduce It is difficult for me to share a reproducible code snippet / example.

In our project, @react-pdf/font is a dependency of @react-pdf/[email protected]([email protected]) and @react-pdf/[email protected]. We use TypeScript, pnpm, and our code is transpiled using ESBuild. When invoking Node on the transpiled JS bundle, we get this stracktrace:

TypeError: Invalid URL
    at new URL (node:internal/url:840:25)
    at Object.<anonymous> (/app/node_modules/.pnpm/[email protected]/node_modules/pdfkit/lib/mixins/pdfa.js:3:33)
    at Module._compile (node:internal/modules/cjs/loader:1871:14)
    at Object..js (node:internal/modules/cjs/loader:2002:10)
    at Module.load (node:internal/modules/cjs/loader:1594:32)
    at Module._load (node:internal/modules/cjs/loader:1396:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at node:internal/main/run_main_module:33:47

It seems that @react-pdf/[email protected] started to depend on [email protected], and TypeError: Invalid URL is raised from there: https://github.com/foliojs/pdfkit/blob/v0.20.1/lib/mixins/pdfa.js#L3

javascript
export const ICC_PROFILE_PATH = new URL(
  './data/sRGB_IEC61966_2_1.icc',
  import.meta.url,
).href;

Expected behavior No exception raised

Desktop (please complete the following information):