test: add compat code for vite v6 (#29677)

This commit is contained in:
翠 / green 2024-10-25 17:54:35 +09:00 committed by GitHub
parent 450d291b18
commit 194ff33975
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2374,7 +2374,7 @@ describe('component islands', () => {
"link": [],
"style": [
{
"innerHTML": "pre[data-v-xxxxx]{color:blue}",
"innerHTML": "pre[data-v-xxxxx]{color:#00f}",
},
],
}
@ -2743,7 +2743,11 @@ function normaliseIslandResult (result: NuxtIslandResponse) {
for (const style of result.head.style) {
if (typeof style !== 'string') {
if (style.innerHTML) {
style.innerHTML = (style.innerHTML as string).replace(/data-v-[a-z0-9]+/g, 'data-v-xxxxx')
style.innerHTML =
(style.innerHTML as string)
.replace(/data-v-[a-z0-9]+/g, 'data-v-xxxxx')
// Vite 6 enables CSS minify by default for SSR
.replace(/blue/, '#00f')
}
if (style.key) {
style.key = style.key.replace(/-[a-z0-9]+$/i, '')