Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Apr 17, 2024
1 parent 9423166 commit 94a5433
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export default function transformSource(
)
return
}
console.log('resource', this.resourcePath, 'clientRefs', clientRefs)

let esmSource = `\
import { createProxy } from "${MODULE_PROXY_PATH}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1041,18 +1041,18 @@ function addClientImport(

// If it's not analyzed as named ESM exports, e.g. if it's mixing `export *` with named exports,
// We'll include all modules since it's not able to do tree-shaking.
if (assumedSourceType === 'auto') {
clientComponentImports[modRequest].add('*')
} else {
for (const name of importedIdentifiers) {
// For cjs module default import, we include the whole module since
const isCjsDefaultImport = isCjsModule && name === 'default'
// Always include __esModule along with cjs module default export,
// to make sure it work with client module proxy from React.
if (isCjsDefaultImport) {
clientComponentImports[modRequest].add('__esModule')
}
clientComponentImports[modRequest].add(name)
for (const name of importedIdentifiers) {
// For cjs module default import, we include the whole module since
const isCjsDefaultImport = isCjsModule && name === 'default'
const isAutoModuleSourceType = assumedSourceType === 'auto'
// Always include __esModule along with cjs module default export,
// to make sure it work with client module proxy from React.
if (isCjsDefaultImport) {
clientComponentImports[modRequest].add('__esModule')
}
if (isAutoModuleSourceType) {
clientComponentImports[modRequest].add('*')
}
clientComponentImports[modRequest].add(name)
}
}

0 comments on commit 94a5433

Please sign in to comment.