Skip to content

nicholasfulton/next-on-pages-bug

Repository files navigation

Possible next-on-pages bug

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.

Reproduction Steps

  1. Create empty next-on-pages project using:
npm create cloudflare@latest -- my-next-app --framework=next
  1. Add a client component to the project:
'use client';

console.log(window);

export default function BasicComponent() {
    return <p>This does nothing.</p>
}
  1. Import to another client component using Next.js dynamic imports:
const BasicComp = dynamic(() => import('./BasicComponent'), { ssr: false });
  1. Convert root layout to edge runtime:
export const runtime = 'edge';
  1. With edge runtime enabled now, building or previewing through Next.js tools (build/start/dev) will continue to work fine, but next-on-pages preview result in the following error when the page is loaded: alt text

About

Demo to show how next/dynamic fails to load on edge runtime.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published