File tree Expand file tree Collapse file tree
packages/plugin-vite/src/plugins/patches Expand file tree Collapse file tree Original file line number Diff line number Diff 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 (
Original file line number Diff line number Diff line change @@ -36,7 +36,6 @@ if (typeof exports === "object" && exports !== null && "default" in exports) {
3636 _default = exports;
3737}` ;
3838
39-
4039const DEFAULT_EXPORT_END = `export default _default;
4140export var __require = exports;` ;
4241const IMPORT_REQUIRE = `import { createRequire } from "node:module";
You can’t perform that action at this time.
0 commit comments