dx: failing preload requests

Massimo Melina committed Jun 8, 2026 at 19:15 UTC 056607bc7d64e3490caf317db3911f3b1d19af38
1 file changed +3 -1
src/serveGuiFiles.ts
+3 -1
@@ -63,8 +63,10 @@ function shouldServeApp(ctx: Koa.Context) {
63
64 function adjustBundlerLinks(ctx: Koa.Context, uri: string, data: string | Buffer) {
65 const ext = extname(ctx.path)
66 + const filesUri = ctx.state.revProxyPath + uri
67 return ext && !ext.match(/\.(css|html|js|ts|scss)/) ? data
67 - : String(data).replace(/((?:import[ (]| from )['"])\//g, `$1${ctx.state.revProxyPath}${uri}`)
68 + : String(data).replace(/((?:import[ (]| from )['"])\//g, `$1${filesUri}`)
69 + .replace(/(assetsURL=function\(([^)]+)\)\{return)"\/"\+\2\}/g, `$1${JSON.stringify(filesUri)}+$2}`) // vite's preload helper uses the configured absolute base for dependency hints
70 }
71
72 const getFaviconTimestamp = debounceAsync(async () => {