Closed advancedlogic closed 1 year ago
Having the same issue, I took a look at #27, which says its fixed
my error looks likes this:
> npm run dev > codeignitervite-svelte@0.0.0 dev > vite
suggestion: ''
},
notes: [],
pluginName: '',
text: 'Could not read from file: C:\\PROJECT_DIR\\node_modules\\pdfjs-dist\\build\\pdf.worker.min.js?url'
}
], warnings: []
}
Node.js v18.12.1
does anyone know howto resolve this? , i'm having the same issue with just the default example and current version of sveltekit .. thanks.
Hi @eddyvinsensius , Please try to reproduce the same bug on stackblitz
Hi, even the example doesn't work for me.
I am using Windows 10
pnpm --version 7.25.1
node --version v18.12.1
C:\Projects\nodejs\svelte-pdf\example〉pnpm run dev 02/10/2023 12:58:14
> svelte-app@0.0.0 dev C:\Projects\nodejs\svelte-pdf\example
> vite
Forced re-optimization of dependencies
Port 5173 is in use, trying another one...
VITE v3.2.5 ready in 655 ms
➜ Local: http://localhost:5174/
➜ Network: use --host to expose
✘ [ERROR] Could not read from file: C:\Projects\nodejs\svelte-pdf\example\node_modules\.pnpm\pdfjs-dist@3.3.122\node_modules\pdfjs-dist\build\pdf.worker.min.js?url
node_modules/.pnpm/svelte-pdf@1.0.16/node_modules/svelte-pdf/PdfViewer.svelte:39:24:
39 │ import pdfjsWorker from "pdfjs-dist/build/pdf.worker.min.js?url";
╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12:58:19 [vite-plugin-svelte] prebundle libraries in progress ...
C:\Projects\nodejs\svelte-pdf\example\node_modules\.pnpm\esbuild@0.15.18\node_modules\esbuild\lib\main.js:1575
let error = new Error(`${text}${summary}`);
^
Error: Build failed with 1 error:
node_modules/.pnpm/svelte-pdf@1.0.16/node_modules/svelte-pdf/PdfViewer.svelte:39:24: ERROR: Could not read from file: C:\Projects\nodejs\svelte-pdf\example\node_modules\.pnpm\pdfjs-dist@3.3.122\node_modules\pdfjs-dist\build\pdf.worker.min.js?url
at failureErrorWithLog (C:\Projects\nodejs\svelte-pdf\example\node_modules\.pnpm\esbuild@0.15.18\node_modules\esbuild\lib\main.js:1575:15)
at C:\Projects\nodejs\svelte-pdf\example\node_modules\.pnpm\esbuild@0.15.18\node_modules\esbuild\lib\main.js:1033:28
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
errors: [
{
detail: undefined,
id: '',
location: {
column: 24,
file: 'node_modules/.pnpm/svelte-pdf@1.0.16/node_modules/svelte-pdf/PdfViewer.svelte',
length: 40,
line: 39,
lineText: 'import pdfjsWorker from "pdfjs-dist/build/pdf.worker.min.js?url";',
namespace: '',
suggestion: ''
},
notes: [],
pluginName: '',
text: 'Could not read from file: C:\\Projects\\nodejs\\svelte-pdf\\example\\node_modules\\.pnpm\\pdfjs-dist@3.3.122\\node_modules\\pdfjs-dist\\build\\pdf.worker.min.js?url'
}
],
warnings: []
}
Node.js v18.12.1
ELIFECYCLE Command failed with exit code 1.
look like an issue with vite, please ref: https://github.com/vitejs/vite/issues/10838
Hi, I was looking at this because I had the same issue. react-pdf
had the same problem and they fixed it by removing the ?url
at the end of the pdfJsWorker import url (not supported by Vite). Maybe that'll help you, here's how they fixed it :
https://github.com/wojtekmaj/react-pdf/compare/v6.0.1...v6.0.2
It worked for me :)
Thanks @antoineMagentine This issue was fixed by https://github.com/vinodnimbalkar/svelte-pdf/pull/50 so closing it.
With the default example I see the pdf for 1 second and then I have error 504 (because it cannot find the file and timeouts) and I keep having this issue:
`✘ [ERROR] Could not read from file: /Users/user/Projects/Git/myproject/static/ui/node_modules/svelte-pdf/node_modules/pdfjs-dist/build/pdf.worker.min.js?url
I am using last version of Svelte/SvelteKit/Vite together with Tailwinds