Repository navigation
Fix the browser build failing to load without import.meta.url - #1874
Merged
blikblum merged 3 commits intoNov 26, 2026
Merged
Conversation
The browser build registered its embedded sRGB ICC profile under the path getIccProfilePath() resolves from import.meta.url, at import time. Bundles for runtimes such as Cloudflare Workers leave import.meta.url undefined, so importing pdfkit threw. The profile is embedded, so register it under a fixed name and point the PDF/A output at that name instead. Fixes foliojs#1873
blikblum
reviewed
Nov 24, 2026
…rofile-import-meta # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1873
What kind of change does this PR introduce?
Bug fix. The browser build registered its embedded sRGB ICC profile at import time, under the path
getIccProfilePath()resolves fromimport.meta.url. Bundles for runtimes such as Cloudflare Workers leaveimport.meta.urlundefined, so importing pdfkit threw.The browser build now registers the profile under a fixed name (
sRGB_IEC61966_2_1.icc) and points the PDF/A output at it, so it never readsimport.meta.url. The Node build is unchanged and still resolves the file on first use.The new test bundles the browser entry the way the release build does, with
import.meta.urlresolved toundefined. It checks that the bundle loads and that PDF/A-1 output still contains the ICC output intent.Checklist: