next.js/test/e2e/app-dir/dynamic-import/app/page.tsx
page.tsx17 lines386 B
// x-ref: https://github.com/vercel/next.js/issues/71840

import { ElementType } from 'react'

async function getImport(
  slug: string,
  exportName: string
): Promise<ElementType> {
  const moduleExports = await import(`./${slug}`)
  return moduleExports[exportName]
}

export default async function Home() {
  const Button = await getImport('button', 'Button')
  return <Button />
}
Quest for Codev2.0.0
/
SIGN IN