From e1c9225c831b9c7dc8e10f3a88c06cd67d4f1bff Mon Sep 17 00:00:00 2001 From: Bogdan Kostyuk Date: Sat, 9 Nov 2024 12:28:54 +0200 Subject: [PATCH] chore: use ?worker&url syntax for getting only worker url --- app/utils/fuzzy.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/utils/fuzzy.ts b/app/utils/fuzzy.ts index d544cfab..ee896403 100644 --- a/app/utils/fuzzy.ts +++ b/app/utils/fuzzy.ts @@ -3,6 +3,8 @@ import type { ShallowRef } from 'vue'; import proxy from 'unenv/runtime/mock/proxy'; +import FuzzyWorkerUrl from '~/workers/fuzzy?worker&url'; + export interface FuzzyWorker { searchWithQuery: (query: string) => Promise> searchForEmoji: (query: string) => Promise> @@ -35,7 +37,7 @@ export async function defineFuzzyWorker() { const { Worker } = coincident(); // https://vitejs.dev/guide/features.html#web-workers - const worker = new Worker(new URL('../workers/fuzzy.ts', import.meta.url), { type: 'module' }); + const worker = new Worker(FuzzyWorkerUrl, { type: 'module' }); // fuzzy worker will be broken till nitro sends headers from route rules in dev mode // https://github.com/unjs/nitro/issues/2749