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 GitHub
parent e1110493e2
commit ed7a14aecc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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') !components.some(c => c.pascalName === component.pascalName && c.mode === 'client')
if (isServerOnly) { if (isServerOnly) {
imports.add(genImport(serverComponentRuntime, [{ name: 'createServerComponent' }])) 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) { if (!options.experimentalComponentIslands) {
logger.warn(`Standalone server components (\`${name}\`) are not yet supported without enabling \`experimental.componentIslands\`.`) 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> </NuxtIsland>
</div> </div>
</div> </div>
<ServerWithClient /> <server-with-client />
<ServerWithNestedClient /> <ServerWithNestedClient />
</div> </div>
</template> </template>