diff --git a/packages/next/src/build/webpack/loaders/next-flight-loader/index.ts b/packages/next/src/build/webpack/loaders/next-flight-loader/index.ts index 6a1e7c44b3f1e..de1dd5095d032 100644 --- a/packages/next/src/build/webpack/loaders/next-flight-loader/index.ts +++ b/packages/next/src/build/webpack/loaders/next-flight-loader/index.ts @@ -97,14 +97,14 @@ const __default__ = proxy.default; let cnt = 0 for (const ref of clientRefs) { if (ref === '') { - esmSource += `\nexports[''] = proxy[''];` + esmSource += `\nexports[''] = createProxy(String.raw\`${this.resourcePath}#\`);` } else if (ref === 'default') { esmSource += ` export { __esModule, $$typeof }; export default __default__;` } else { esmSource += ` -const e${cnt} = proxy["${ref}"]; +const e${cnt} = createProxy(String.raw\`${this.resourcePath}#${ref}\`); export { e${cnt++} as ${ref} };` } } diff --git a/test/e2e/app-dir/mdx/app/client.tsx b/test/e2e/app-dir/mdx/app/client.tsx new file mode 100644 index 0000000000000..e0708c7350ac1 --- /dev/null +++ b/test/e2e/app-dir/mdx/app/client.tsx @@ -0,0 +1,5 @@ +'use client' + +export function Client() { + return