Skip to content

Commit

Permalink
fix(optimizer): fix cjs interop for packages that cannot be
Browse files Browse the repository at this point in the history
statically analyzed by esbuild, e.g. phoenix

close #1821
  • Loading branch information
yyx990803 committed Jan 31, 2021
1 parent 6895726 commit 3b85296
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/vite/src/node/optimizer/esbuildDepPlugin.ts
Expand Up @@ -130,7 +130,9 @@ export function esbuildDepPlugin(
const [imports, exports] = exportsData[id]
if (!imports.length && !exports.length) {
// cjs
contents += `import d from "${relativePath}";export default d;`
contents +=
`import d from "${relativePath}";export default d;` +
`\nexport * from "${relativePath}"`
} else {
if (exports.includes('default')) {
contents += `import d from "${relativePath}";export default d;`
Expand Down

0 comments on commit 3b85296

Please sign in to comment.