Skip to content

Commit 67ef9c5

Browse files
bartlomiejuclaude
andcommitted
fix: update stale comment and remove extra blank line
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5e12e05 commit 67ef9c5

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

packages/plugin-vite/src/plugins/patches/commonjs.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,8 @@ export function cjsPlugin(
364364
const mapped = mappedNs[i];
365365

366366
const key = path.scope.generateUid("k");
367-
// Guard the for-in body with a typeof check so that
368-
// namespace properties are not assigned onto a primitive
369-
// default (e.g. when exports.default is a string).
367+
// Only spread namespace properties when the module has no
368+
// explicit default export (i.e. "default" not in exports).
370369
path.pushContainer(
371370
"body",
372371
t.ifStatement(

packages/plugin-vite/src/plugins/patches/commonjs_test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ if (typeof exports === "object" && exports !== null && "default" in exports) {
3636
_default = exports;
3737
}`;
3838

39-
4039
const DEFAULT_EXPORT_END = `export default _default;
4140
export var __require = exports;`;
4241
const IMPORT_REQUIRE = `import { createRequire } from "node:module";

0 commit comments

Comments
 (0)