Files
supabase/apps
Alaister Young eb9bc4fd46 fix(studio): spawn GraphiQL's Monaco workers off the main thread in the TanStack build
GraphiQLTab imports graphiql/setup-workers/webpack, whose
new Worker(new URL('monaco-editor/...', import.meta.url)) registrations
only work when the bundler rewrites the URLs. Vite doesn't rewrite bare
specifiers inside new URL(..., import.meta.url), so on
/project/[ref]/integrations/graphiql/graphiql the json /
editorWorkerService / graphql workers 404'd and Monaco fell back to the
main thread ('Could not create web worker(s)...' console warning).

Add a graphiqlViteWorkers plugin that resolves the import to graphiql's
own setup-workers/vite variant (same workers via ?worker imports) in
client builds, leaving SSR resolution and the Next build untouched — app
source keeps the .../webpack specifier. The setup-workers chain is also
excluded from optimizeDeps: the Rolldown dep optimizer can't load ?worker
ids (UNLOADABLE_DEPENDENCY), so the modules must go through the normal
transform pipeline where Vite's built-in worker plugin handles them.

Verified: vite dev serves the vite setup-workers module for GraphiQLTab
with each ?worker import transformed into a WorkerWrapper constructor;
vite build emits json.worker/editor.worker/graphql.worker chunks; next
dev (turbopack) still compiles the graphiql route; tsc --noEmit clean.

Claude-Session: https://claude.ai/code/session_01MLH8WVg8zBJnmZTYTV3ooo
2026-07-07 09:41:39 +08:00
..