diff --git a/compose/web/Caddyfile b/compose/web/Caddyfile index f476be1..57a7356 100644 --- a/compose/web/Caddyfile +++ b/compose/web/Caddyfile @@ -1,5 +1,27 @@ :80 { root * /srv - file_server - try_files {path} /index.html + + # /wails/runtime.js is injected by the Wails desktop wrapper, which serves + # the same dist/ from its own asset handler. In a browser it does not + # exist, and the SPA fallback below answered it with index.html — so the + # browser parsed "" as JavaScript and threw + # "SyntaxError: expected expression, got '<'" on every page load. + # Return a real 404 instead: the tag fails quietly, and the desktop app is + # unaffected because it never reaches this server. + handle /wails/* { + error 404 + } + + # Same reasoning for any other asset: a missing .js/.css/.map answered with + # HTML is always a confusing parse error rather than an honest 404. Only + # real routes should fall through to the SPA. + @asset path_regexp \.(js|mjs|css|map|json|png|jpg|svg|ico|woff2?)$ + handle @asset { + file_server + } + + handle { + file_server + try_files {path} /index.html + } } diff --git a/web/src/lib/components/EntityDetailContent.svelte b/web/src/lib/components/EntityDetailContent.svelte index 309561e..8cf90ef 100644 --- a/web/src/lib/components/EntityDetailContent.svelte +++ b/web/src/lib/components/EntityDetailContent.svelte @@ -1,5 +1,5 @@