From ed7a14aecc7e876c5078698a50d78531eb9dc0b5 Mon Sep 17 00:00:00 2001 From: Julien Huang Date: Mon, 1 Jul 2024 10:07:25 +0200 Subject: [PATCH] fix(nuxt): use pascal name when loading server component (#27928) --- packages/nuxt/src/components/loader.ts | 2 +- test/fixtures/basic/pages/islands.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/components/loader.ts b/packages/nuxt/src/components/loader.ts index ec8723d0aa..b8e5d38b62 100644 --- a/packages/nuxt/src/components/loader.ts +++ b/packages/nuxt/src/components/loader.ts @@ -58,7 +58,7 @@ export const loaderPlugin = createUnplugin((options: LoaderOptions) => { !components.some(c => c.pascalName === component.pascalName && c.mode === 'client') if (isServerOnly) { imports.add(genImport(serverComponentRuntime, [{ name: 'createServerComponent' }])) - imports.add(`const ${identifier} = createServerComponent(${JSON.stringify(name)})`) + imports.add(`const ${identifier} = createServerComponent(${JSON.stringify(component.pascalName)})`) if (!options.experimentalComponentIslands) { logger.warn(`Standalone server components (\`${name}\`) are not yet supported without enabling \`experimental.componentIslands\`.`) } diff --git a/test/fixtures/basic/pages/islands.vue b/test/fixtures/basic/pages/islands.vue index e204b67e20..148675861b 100644 --- a/test/fixtures/basic/pages/islands.vue +++ b/test/fixtures/basic/pages/islands.vue @@ -109,7 +109,7 @@ const count = ref(0) - +