Skip to content

Commit

Permalink
fix(vite-node): fix errors caused by commonjs export circular referen…
Browse files Browse the repository at this point in the history
…ces (#3570)
  • Loading branch information
rxliuli authored Jun 15, 2023
1 parent 368b825 commit b097cef
Show file tree
Hide file tree
Showing 8 changed files with 251 additions and 199 deletions.
2 changes: 1 addition & 1 deletion packages/vite-node/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ export class ViteNodeRunner {
set: (_, p, value) => {
// treat "module.exports =" the same as "exports.default =" to not have nested "default.default",
// so "exports.default" becomes the actual module
if (p === 'default' && this.shouldInterop(modulePath, { default: value })) {
if (p === 'default' && this.shouldInterop(modulePath, { default: value }) && cjsExports !== value) {
exportAll(cjsExports, value)
exports.default = value
return true
Expand Down
Loading

0 comments on commit b097cef

Please sign in to comment.