diff --git a/test/e2e/app-dir/dynamic/app/dynamic/named-export-unwrapped/client.js b/test/e2e/app-dir/dynamic/app/dynamic/named-export-unwrapped/client.js new file mode 100644 index 0000000000000..f190f1985245d --- /dev/null +++ b/test/e2e/app-dir/dynamic/app/dynamic/named-export-unwrapped/client.js @@ -0,0 +1,5 @@ +'use client' + +export function Button(props) { + return +} diff --git a/test/e2e/app-dir/dynamic/app/dynamic/named-export/page.js b/test/e2e/app-dir/dynamic/app/dynamic/named-export/page.js index b767273ab6077..3285b72c5f559 100644 --- a/test/e2e/app-dir/dynamic/app/dynamic/named-export/page.js +++ b/test/e2e/app-dir/dynamic/app/dynamic/named-export/page.js @@ -2,7 +2,7 @@ import dynamic from 'next/dynamic' const Button = dynamic(() => import('./client').then((mod) => { - return mod.Button + return { default: mod.Button } }) ) diff --git a/test/e2e/app-dir/dynamic/dynamic.test.ts b/test/e2e/app-dir/dynamic/dynamic.test.ts index 09157dec3ba15..2c4fdec7a5aee 100644 --- a/test/e2e/app-dir/dynamic/dynamic.test.ts +++ b/test/e2e/app-dir/dynamic/dynamic.test.ts @@ -58,6 +58,11 @@ createNextDescribe( expect($('h1').text()).toBe('hello') }) + it('14.x behavior: should support dynamic import that returns a client component not wrapped in a module', async () => { + const $ = await next.render$('/dynamic/named-export-unwrapped') + expect($('#client-button').text()).toBe('this is a client button') + }) + describe('no SSR', () => { it('should not render client component imported through ssr: false in client components in edge runtime', async () => { // noSSR should not show up in html