Files
Alaister Young 4f5759085e fix(studio): load Deno typings for edge-function editors in the TanStack build
AIEditor loaded Monaco's Deno extra libs via /* @vite-ignore */ dynamic
imports of @/public/deno/*.d.ts. Under Next/turbopack the raw-loader rule
serves them as text modules, but under Vite the ignored imports failed at
runtime (caught + console.error), so edge-function editors silently got no
Deno type hints in the TanStack build.

Extend the md raw loader in vite.config.ts into rawTextLoader, mirroring
both next.config.ts raw-loader rules. The two .d.ts files resolve through
an exact-specifier allowlist to \0-virtual ids served from a load hook:
Rolldown's native dep scanner skips JS plugin hooks and hard-fails parsing
TS declaration syntax (get stdin(): ...;) as runtime TS — which is why the
@vite-ignore hack existed — and the \0 id keeps the scanner externalizing
the module instead. The AIEditor imports stay literal (statically
analyzable by both bundlers) with the 'as string' cast keeping tsc from
resolving the .d.ts files as declaration files.

Verified: vite dev serves both modules as JS string modules and the dep
scan passes; vite build emits them as string chunks; next dev (turbopack)
still compiles /project/[ref]/functions/new; tsc --noEmit clean.

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