LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
[FIX] Fix PDF.js worker require is not defined error in staging (#1717)
vishnuszipstack7f44a6760b10
diff --git a/frontend/.gitignore b/frontend/.gitignoreindex f287e6415..16b4aa25e 100644--- a/frontend/.gitignore+++ b/frontend/.gitignore@@ -11,6 +11,9 @@# production/build+# pdfjs worker file (copied from node_modules via postinstall)+/public/pdf.worker.min.js+# misc.DS_Store.env.localdiff --git a/frontend/package.json b/frontend/package.jsonindex 535c95fd2..8d11f6c47 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -57,6 +57,7 @@"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.jsindex 26e25a720..47a972925 100644--- a/frontend/src/helpers/pdfWorkerConfig.js+++ b/frontend/src/helpers/pdfWorkerConfig.js@@ -1,6 +1,4 @@-// Webpack 5 / Vite compatible asset module-// Works with both CRA (Webpack) and Vite bundlers-export const PDF_WORKER_URL = new URL(- "pdfjs-dist/build/pdf.worker.min.js",- import.meta.url-).toString();+// 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";