There seems to be an issue where the bundle is not formed correctly when dynamic imports are used in the edge runtime, affecting next-on-pages.
- Create empty next-on-pages project using:
npm create cloudflare@latest -- my-next-app --framework=next- Add a client component to the project:
'use client';
console.log(window);
export default function BasicComponent() {
return <p>This does nothing.</p>
}- Import to another client component using Next.js dynamic imports:
const BasicComp = dynamic(() => import('./BasicComponent'), { ssr: false });- Convert root layout to edge runtime:
export const runtime = 'edge';