Skip to content

Commit f4ff26d

Browse files
committed
remove an unnecessary cache on "__toCommonJS"
1 parent 4c86033 commit f4ff26d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

internal/runtime/runtime.go

+4-9
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,10 @@ func code(isES6 bool) string {
228228
), module)
229229
}
230230
231-
// Converts the module from ESM to CommonJS
232-
export var __toCommonJS = /* @__PURE__ */ (cache => {
233-
return (module, temp) => {
234-
return (cache && cache.get(module)) || (
235-
temp = __reExport(__markAsModule({}), module, /* copyDefault */ 1),
236-
cache && cache.set(module, temp),
237-
temp)
238-
}
239-
})(typeof WeakMap !== 'undefined' ? new WeakMap : 0)
231+
// Converts the module from ESM to CommonJS. This clones the input module
232+
// object with the addition of a non-enumerable "__esModule" property set
233+
// to "true", which overwrites any existing export named "__esModule".
234+
export var __toCommonJS = module => __reExport(__markAsModule({}), module, /* copyDefault */ 1)
240235
241236
// For TypeScript decorators
242237
// - kind === undefined: class

0 commit comments

Comments
 (0)