Skip to content

Commit 694b43b

Browse files
munessclaude
andcommitted
fix: use unpkg CDN for pdfjs worker instead of bundled file
The new URL('pdfjs-dist/...', import.meta.url) approach requires pdfjs-dist to be symlinked directly under apps/web/node_modules, which is fragile with pnpm workspaces. Using the CDN URL (pinned to pdfjs.version) is simpler and more reliable — no build-time asset bundling needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5339208 commit 694b43b

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

apps/web/src/components/PdfViewer.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { Document, Page, pdfjs } from 'react-pdf'
33

44
import { fetchDocumentPdfBuffer } from '../api'
55

6-
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
7-
'pdfjs-dist/build/pdf.worker.min.mjs',
8-
import.meta.url,
9-
).toString()
6+
pdfjs.GlobalWorkerOptions.workerSrc = `https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`
107

118
const ZOOM_MIN = 0.5
129
const ZOOM_MAX = 3.0

0 commit comments

Comments
 (0)