Unverified Commit 62b63098 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Fix rsc export component name detection (#33608)

parent 0fb11839
......@@ -43,7 +43,7 @@ async function parseImportsInfo(
let transformedSource = ''
let lastIndex = 0
let defaultExportName = 'RSComponent'
let defaultExportName = 'RSCComponent'
for (let i = 0; i < body.length; i++) {
const node = body[i]
......@@ -89,7 +89,12 @@ async function parseImportsInfo(
continue
}
case 'ExportDefaultDeclaration': {
defaultExportName = node.declaration.id.name
const def = node.declaration
if (def.type === 'Identifier') {
defaultExportName = def.name
} else if (def.type === 'FunctionDeclaration') {
defaultExportName = def.id.name
}
break
}
default:
......
import NextImage from 'next/image'
import src from '../../public/test.jpg'
export default function Image() {
// Keep arrow function to test rsc loaders
const Page = () => {
return <NextImage src={src} />
}
export default Page
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment