vinodnimbalkar/svelte-pdf

Uncaught (in promise) SyntaxError: import not found: default

hsb-tonmoy opened this issue · 1 comments

I'm trying to use it with Sveltekit. I installed svelte-pdf as a dev dependency. This is what my code looks like:

<script>
	import { onMount } from 'svelte';
	let PdfViewer;

	onMount(async () => {
		const module = await import('svelte-pdf');
		PdfViewer = module.default;
	});

	export let url;
</script>

<svelte:component this={PdfViewer} {url} />

Once the component mounts, the browser gives me the error:

Uncaught (in promise) SyntaxError: import not found: default

It refers to PdfViewer.svelte:41:7 which is:

import pdfjsWorker from "/node_modules/pdfjs-dist/build/pdf.worker.entry.js?v=c744c57a";

u cant import in onMount 😭