fix(nuxt): use pascal name when loading server component (#27928)

This commit is contained in:
Julien Huang 2024-07-01 10:07:25 +02:00 committed by Daniel Roe
parent 951c07d180
commit 950b5b6c49
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B
2 changed files with 2 additions and 2 deletions

View File

@ -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\`.`)
}

View File

@ -109,7 +109,7 @@ const count = ref(0)
</NuxtIsland>
</div>
</div>
<ServerWithClient />
<server-with-client />
<ServerWithNestedClient />
</div>
</template>