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/renderer@4.6.0(react@19.2.8) and @react-pdf/types@2.13.1.
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/pdfkit@0.20.1/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/font@4.1.0 started to depend on pdfkit@0.20.1, and TypeError: Invalid URL is raised from there:
https://github.com/foliojs/pdfkit/blob/v0.20.1/lib/mixins/pdfa.js#L3
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):
- OS: Linux
- React-pdf version:
@react-pdf/renderer@4.6.0(react@19.2.8)
Describe the bug
Upgrading
@react-pdf/fontfrom4.0.9to4.1.0or4.1.1caused aTypeError: Invalid URLTo Reproduce
It is difficult for me to share a reproducible code snippet / example.
In our project,
@react-pdf/fontis a dependency of@react-pdf/renderer@4.6.0(react@19.2.8)and@react-pdf/types@2.13.1.We use TypeScript, pnpm, and our code is transpiled using ESBuild.
When invoking Node on the transpiled JS bundle, we get this stracktrace:
It seems that
@react-pdf/font@4.1.0started to depend onpdfkit@0.20.1, andTypeError: Invalid URLis raised from there:https://github.com/foliojs/pdfkit/blob/v0.20.1/lib/mixins/pdfa.js#L3
Expected behavior
No exception raised
Desktop (please complete the following information):
@react-pdf/renderer@4.6.0(react@19.2.8)