pdfjs-dist Font Files Can Go Missing From Next.js Standalone Builds
A developer found that the standard_fonts directory bundled with pdfjs-dist can be left out of Next.js standalone output because file tracing cannot detect how it is loaded at runtime. The omission fails silently, since missing fonts raise no error and only text extraction from PDFs using standard fonts such as Helvetica breaks. In pdfjs-dist v6, an unresolvable font path makes getTextContent() throw, which a surrounding try/catch can hide, leaving near-empty extracted text. The team addressed this by explicitly including the directory in configuration via outputFileTracingIncludes. They also added a fail-fast check at production startup to catch the directory if it goes missing again.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in