Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

[FIX] Updated pdf js worker to load from cdn (#1718)

vishnuszipstack09f62be01d40
diff --git a/frontend/.gitignore b/frontend/.gitignore
index 16b4aa25e..f287e6415 100644
--- a/frontend/.gitignore
+++ b/frontend/.gitignore
@@ -11,9 +11,6 @@
# production
/build
-# pdfjs worker file (copied from node_modules via postinstall)
-/public/pdf.worker.min.js
-
# misc
.DS_Store
.env.local
diff --git a/frontend/package.json b/frontend/package.json
index 8d11f6c47..535c95fd2 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -57,7 +57,6 @@
"zustand": "^4.3.8"
},
"scripts": {
- "postinstall": "cp node_modules/pdfjs-dist/build/pdf.worker.min.js public/pdf.worker.min.js",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
diff --git a/frontend/src/helpers/pdfWorkerConfig.js b/frontend/src/helpers/pdfWorkerConfig.js
index 47a972925..5c9e5f12b 100644
--- a/frontend/src/helpers/pdfWorkerConfig.js
+++ b/frontend/src/helpers/pdfWorkerConfig.js
@@ -1,4 +1,4 @@
-// Use the worker file from the public folder (served as static asset)
-// This avoids Webpack processing which incorrectly bundles it with require() statements
-// Note: The ?url import suffix only works in Vite, not in CRA (Webpack)
-export const PDF_WORKER_URL = "/pdf.worker.min.js";
+// Use CDN to load the worker file
+// Version must match the installed pdfjs-dist version (3.11.174 via @react-pdf-viewer/core)
+export const PDF_WORKER_URL =
+ "https://unpkg.com/[email protected]/build/pdf.worker.min.js";