fix pdf.js worker dual-instance when uploading via evidence-source.
Alias and dedupe pdfjs-dist so GlobalWorkerOptions.workerSrc set in main.tsx reaches getDocument in the linked evidence-source package; allow sibling fs roots.
This commit is contained in:
parent
6bc1650285
commit
dc7d8f7ce8
1 changed files with 13 additions and 1 deletions
|
|
@ -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"),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue