Skip to content

Commit

Permalink
fix barrel optmization case
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed May 29, 2024
1 parent 11e83c9 commit 53951ac
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,17 @@ export default function transformSource(
let esmSource = `\
import { createProxy } from "${MODULE_PROXY_PATH}"
const proxy = createProxy(String.raw\`${this.resourcePath}\`)
const proxy = createProxy(String.raw\`${resourceKey}\`)
`
let cnt = 0
for (const ref of clientRefs) {
if (ref === '') {
esmSource += `\nexports[''] = proxy[''];`
esmSource += `exports[''] = proxy['']\n`
} else if (ref === 'default') {
esmSource += `\
export default createProxy(String.raw\`${resourceKey}#default\`);
`
esmSource += `export default createProxy(String.raw\`${resourceKey}#default\`)\n`
} else {
esmSource += `
const e${cnt} = proxy["${ref}"];
export { e${cnt++} as ${ref} };`
esmSource += `const e${cnt} = proxy["${ref}"];\n`
esmSource += `export { e${cnt++} as ${ref} };\n`
}
}

Expand Down

0 comments on commit 53951ac

Please sign in to comment.