Skip to content

Commit b097cef

Browse files
authored
fix(vite-node): fix errors caused by commonjs export circular references (#3570)
1 parent 368b825 commit b097cef

File tree

8 files changed

+251
-199
lines changed

8 files changed

+251
-199
lines changed

packages/vite-node/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ export class ViteNodeRunner {
330330
set: (_, p, value) => {
331331
// treat "module.exports =" the same as "exports.default =" to not have nested "default.default",
332332
// so "exports.default" becomes the actual module
333-
if (p === 'default' && this.shouldInterop(modulePath, { default: value })) {
333+
if (p === 'default' && this.shouldInterop(modulePath, { default: value }) && cjsExports !== value) {
334334
exportAll(cjsExports, value)
335335
exports.default = value
336336
return true

0 commit comments

Comments
 (0)