Skip to content

Commit b59b0a7

Browse files
committed
fix barrel optmization case
1 parent 0cce6e7 commit b59b0a7

File tree

1 file changed

+5
-8
lines changed
  • packages/next/src/build/webpack/loaders/next-flight-loader

1 file changed

+5
-8
lines changed

packages/next/src/build/webpack/loaders/next-flight-loader/index.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,17 @@ export default function transformSource(
104104
let esmSource = `\
105105
import { createProxy } from "${MODULE_PROXY_PATH}"
106106
107-
const proxy = createProxy(String.raw\`${this.resourcePath}\`)
107+
const proxy = createProxy(String.raw\`${resourceKey}\`)
108108
`
109109
let cnt = 0
110110
for (const ref of clientRefs) {
111111
if (ref === '') {
112-
esmSource += `\nexports[''] = proxy[''];`
112+
esmSource += `exports[''] = proxy['']\n`
113113
} else if (ref === 'default') {
114-
esmSource += `\
115-
export default createProxy(String.raw\`${resourceKey}#default\`);
116-
`
114+
esmSource += `export default createProxy(String.raw\`${resourceKey}#default\`)\n`
117115
} else {
118-
esmSource += `
119-
const e${cnt} = proxy["${ref}"];
120-
export { e${cnt++} as ${ref} };`
116+
esmSource += `const e${cnt} = proxy["${ref}"];\n`
117+
esmSource += `export { e${cnt} as ${ref} };\n`
121118
}
122119
}
123120

0 commit comments

Comments
 (0)