Make worker functional in dev mode

This commit is contained in:
Johannes Zillmann 2021-01-08 17:37:19 +01:00
parent ae6d47d329
commit 21ecfd35bd
2 changed files with 2 additions and 3 deletions

View File

@ -4,6 +4,7 @@ module.exports = {
public: { url: '/', static: true },
src: { url: '/dist' },
'../core/src': { url: '/core' },
'node_modules/pdfjs-dist/build/': { url: '/worker', static: true },
},
plugins: [
['@snowpack/plugin-build-script', { cmd: 'postcss', input: ['.css'], output: ['.css'] }],

View File

@ -6,9 +6,7 @@ import { Writable, writable } from 'svelte/store';
export let parseResult: Writable<ParseResult> = writable(undefined);
// TODO this will setup fake worker cause getMainThreadWorkerMessageHandler isn't null
import pdfjsWorker from 'pdfjs-dist//es5/build/pdf.worker.entry';
pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;
pdfjs.GlobalWorkerOptions.workerSrc = 'worker/pdf.worker.min.js';
const parser = pdfParser(pdfjs);