reference the file-search worker by its packaged .js name (#10290)

svelte-package does not rewrite the string literal inside new URL(), and ships only the compiled searchWorker.js — so the .ts URL is dangling for any downstream consumer of @windmill-labs/components (rollup: Could not resolve searchWorker.ts). Vite maps .js back to the .ts source in-repo, so both builds resolve.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-07-23 23:03:25 +02:00
committed by GitHub
co-authored by Claude Opus 4.8
parent f02df7fc45
commit a29e13fd18
@@ -294,7 +294,10 @@ export function searchFilesInWorker(
): Promise<SearchResult> {
let worker: Worker
try {
worker = new Worker(new URL('./searchWorker.ts', import.meta.url), { type: 'module' })
// Reference the worker by its .js name: svelte-package doesn't rewrite this
// string literal and ships only searchWorker.js, so a `.ts` URL is dangling
// when the package is consumed downstream (vite maps `.js`→`.ts` here in-repo).
worker = new Worker(new URL('./searchWorker.js', import.meta.url), { type: 'module' })
} catch {
return searchFiles(entries, pattern, opts)
}