diff --git a/vite.config.ts b/vite.config.ts index 134198a..fcc3c9d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -37,14 +37,26 @@ export default defineConfig({ "@binder": resolve(__dirname, "../evidence-binder/src"), "@work": resolve(__dirname, "../citation-work/src/work"), "@app": resolve(__dirname, "src/app"), + // Force a single pdfjs-dist instance across the umbrella and linked + // packages (evidence-source, citation-work, …). Each sibling has its + // own node_modules/pdfjs-dist path; without this alias Vite loads two + // module graphs, so main.tsx's GlobalWorkerOptions.workerSrc never + // reaches getDocument() inside evidence-source — upload fails with + // 'No "GlobalWorkerOptions.workerSrc" specified.' + "pdfjs-dist": resolve(__dirname, "node_modules/pdfjs-dist"), }, + // Belt-and-braces for the same dual-instance problem (React too). + dedupe: ["pdfjs-dist", "react", "react-dom"], }, server: { fs: { - // Allow Vite to serve /fixtures/pdfs/*.pdf from the project root. + // Allow Vite to serve /fixtures/pdfs/*.pdf from the project root, + // and to read linked sibling packages outside this repo root. allow: [ resolve(__dirname), resolve(__dirname, "../citation-engine"), + resolve(__dirname, "../evidence-source"), + resolve(__dirname, "../evidence-anchor"), resolve(__dirname, "../evidence-binder"), resolve(__dirname, "../citation-work"), ],