From 5e562212626d2e2142ce972060d14eadb19962aa Mon Sep 17 00:00:00 2001 From: Norman Niati Date: Wed, 10 Jun 2026 12:49:41 +0200 Subject: [PATCH] fix(loader): propagate plugin asset version digest to scoped stylesheet --- ui/src/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/src/index.js b/ui/src/index.js index 53afde1..4bba276 100644 --- a/ui/src/index.js +++ b/ui/src/index.js @@ -11,7 +11,16 @@ if (typeof document !== 'undefined') { const link = document.createElement('link') link.id = id link.rel = 'stylesheet' - link.href = new URL(/* @vite-ignore */ './index.css', import.meta.url).href + // Carry over the `?v=` cache-busting query the host puts on the JS + // bundle URL (see app-ui plugins/loader.js): relative URL resolution drops + // the base query, so without this the stylesheet stays unversioned while + // the JS rotates its digest on every plugin upgrade. The scoped-style + // `data-v-*` ids then mismatch between a freshly-loaded JS bundle and a + // cached index.css, silently breaking every SFC layout in this plugin. + const cssUrl = new URL(/* @vite-ignore */ './index.css', import.meta.url) + const selfQuery = new URL(import.meta.url).search + if (selfQuery) cssUrl.search = selfQuery + link.href = cssUrl.href document.head.appendChild(link) } }