fix(nuxt): transform client fallbacks directly on SFCs (#20835)

This commit is contained in:
Julien Huang 2023-05-13 23:39:50 +02:00 committed by GitHub
parent 6a052b583b
commit 900ee6dc8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -25,7 +25,7 @@ export const clientFallbackAutoIdPlugin = createUnplugin((options: LoaderOptions
if (include.some(pattern => id.match(pattern))) { if (include.some(pattern => id.match(pattern))) {
return true return true
} }
return isVue(id, { type: ['template'] }) return isVue(id)
}, },
transform (code, id) { transform (code, id) {
if (!CLIENT_FALLBACK_RE.test(code)) { return } if (!CLIENT_FALLBACK_RE.test(code)) { return }

View File

@ -343,7 +343,8 @@ describe('pages', () => {
// ensure components reactivity once mounted // ensure components reactivity once mounted
await page.locator('#increment-count').click() await page.locator('#increment-count').click()
expect(await page.locator('#sugar-counter').innerHTML()).toContain('Sugar Counter 12 x 1 = 12') expect(await page.locator('#sugar-counter').innerHTML()).toContain('Sugar Counter 12 x 1 = 12')
// #20833
expect(await page.locator('body').innerHTML()).not.toContain('Hello world !')
await page.close() await page.close()
}) })