Skip to content

Commit 09f62be

Browse files
[FIX] Updated pdf js worker to load from cdn (#1718)
* updated pdf js worker to load from cdn * lint issue fix
1 parent 7f44a67 commit 09f62be

3 files changed

Lines changed: 4 additions & 8 deletions

File tree

frontend/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
# production
1212
/build
1313

14-
# pdfjs worker file (copied from node_modules via postinstall)
15-
/public/pdf.worker.min.js
16-
1714
# misc
1815
.DS_Store
1916
.env.local

frontend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"zustand": "^4.3.8"
5858
},
5959
"scripts": {
60-
"postinstall": "cp node_modules/pdfjs-dist/build/pdf.worker.min.js public/pdf.worker.min.js",
6160
"start": "react-scripts start",
6261
"build": "react-scripts build",
6362
"test": "react-scripts test",
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Use the worker file from the public folder (served as static asset)
2-
// This avoids Webpack processing which incorrectly bundles it with require() statements
3-
// Note: The ?url import suffix only works in Vite, not in CRA (Webpack)
4-
export const PDF_WORKER_URL = "/pdf.worker.min.js";
1+
// Use CDN to load the worker file
2+
// Version must match the installed pdfjs-dist version (3.11.174 via @react-pdf-viewer/core)
3+
export const PDF_WORKER_URL =
4+
"https://unpkg.com/pdfjs-dist@3.11.174/build/pdf.worker.min.js";

0 commit comments

Comments
 (0)