Closed rjwalters closed 1 year ago
I think the problem here was that I still wasn't providing the correct location for the worker script.
I managed to get it working like this:
import { page } from '$app/stores';
onMount(async () => {
// Setup downzip object
downZip = new DownZip();
const mapScriptUrl = (_: string) => {
return `${$page.url.protocol}//${$page.url.host}/downzip-sw.js`;
};
await downZip.register({
mapScriptUrl,
});
});
I needed to change things up again to get it to run with adapter-node:
onMount(async () => {
// @ts-ignore
let downzipModule = await import('downzip');
let downZip = new downzipModule.default();
const mapScriptUrl = (_: string) => {
return `${$page.url.protocol}//${$page.url.host}/downzip-sw.js`;
};
await downZip.register({
mapScriptUrl,
});
});
I used
rollup-plugin-copy
as in the readme example.(vite.config.js)
I attempted to load and use the module like this:
(svelte component)