diff --git a/web/vite.config.ts b/web/vite.config.ts index c20b0fee..e80dadf0 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -13,6 +13,9 @@ const tokensPlugin = { // rendered index.html so the runtime Go server can substitute per- // instance branding. In dev (`vite dev`), the marker stays as a // comment and the SPA falls back to the literal app.html title. +// `enforce: 'post'` ensures this runs after SvelteKit's own +// transformIndexHtml so %sveltekit.head% is already expanded into +// hydration markup before our anchors are rewritten. const injectGoTokensPlugin = { name: 'minstrel-inject-go-tokens', apply: 'build' as const, @@ -29,6 +32,17 @@ const injectGoTokensPlugin = { `; + + // Fail loudly if either anchor drifts. A silent .replace() no-op + // would ship a build with un-substituted Go template tokens missing, + // and the runtime brand override would silently break — exactly the + // class of regression a build-time plugin should catch. + if (!html.includes('