Closed eddyvinsensius closed 1 year ago
@eddyvinsensius which version of the package are you using?
i do a git clone from this github (git clone https://github.com/gtm-nayan/svelte-pdfjs.git) but it's give me error when i do npm run build
then i try to create blank project with latest sveltekit and do a manual copy from this github (src, config, etc) now it's running ok ..
so i don't know what cause the error from my 1st try
do i got the latest version from my 2nd attemp because now everything is running ok where can i get the latest version beside from src at this github?
thanks.
The latest version svelte-pdfjs@0.6.1 is published on npm. You can install it with npm i --save-dev svelte-pdfjs
i try the latest version svelte-pdfjs@0.6.1 so i create a blank project of sveltekit latest also do npm i --save-dev svelte-pdfjs (which is version 0.6.1) and test it with default example but now i'm getting this error:
Internal server error: /src/routes/+page.svelte:5:49 Unexpected token Plugin: vite-plugin-svelte File: /src/routes/+page.svelte:5:49 3 | import { base } from '$app/paths'; 4 | 5 | import { Document, Page, preferThisHeight, type MultipleOf90 } from 'svelte-pdfjs'; ^ 6 | 7 | let scale = 1;
(the ^ point to "MultipleOf90") what am i missing? thanks.
That's probably because you're not using Typescript in your app or forgot to add either the preprocessor or the lang="ts" attribute.
ok it is running smoothly now , thank you for your wonderful svelte pdfjs module.
Glad you got it working. I'll close the issue.
with the default example: npm run dev , it works just fine, but when npm run build , it gives error:
import { getDocument } from "pdfjs-dist"; ^^^^^^^^^^^ SyntaxError: Named export 'getDocument' not found. The requested module 'pdfjs-dist' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using:
import pkg from 'pdfjs-dist'; const { getDocument } = pkg;
file:///C:/svelte/tes/svelte-pdfjs/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:35 throw new Error(format(details)); ^
Error: 500 / at file:///C:/svelte/tes/svelte-pdfjs/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:35:11 at save (file:///C:/svelte/tes/svelte-pdfjs/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:360:4) at visit (file:///C:/svelte/tes/svelte-pdfjs/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:210:3)
Node.js v18.13.0 [vite-plugin-sveltekit-build] Prerendering failed with code 1 error during build: Error: Prerendering failed with code 1 at ChildProcess. (file:///C:/svelte/tes/svelte-pdfjs/node_modules/@sveltejs/kit/src/exports/vite/index.js:483:15)
at ChildProcess.emit (node:events:513:28)
at ChildProcess._handle.onexit (node:internal/child_process:291:12)