Skip to content

Commit 66ee8fe

Browse files
committed
Fix again, exports is entirely reassigned, not augmented
1 parent c798c02 commit 66ee8fe

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

Herebyfile.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
209209
};
210210

211211
if (taskOptions.exportIsTsObject) {
212-
// Monaco bundles us as ESM by wrapping our code with something that defines `module.exports`
212+
// Monaco bundles us as ESM by wrapping our code with something that defines module.exports
213213
// but then does not use it, instead using the `ts` variable. Ensure that if we think we're CJS
214214
// that we still set `ts` to the module.exports object.
215-
options.footer = { js: `})(typeof module !== "undefined" && module.exports ? (ts = module.exports, module) : { exports: ts });` };
215+
options.footer = { js: `})(typeof module !== "undefined" && module.exports ? module : { exports: ts });\nif (typeof module !== "undefined" && module.exports) { ts = module.exports; }` };
216216

217217
// esbuild converts calls to "require" to "__require"; this function
218218
// calls the real require if it exists, or throws if it does not (rather than

src/compiler/core.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2749,6 +2749,5 @@ export function isNodeLikeSystem(): boolean {
27492749
// and definitely exist.
27502750
return typeof process !== "undefined"
27512751
&& !!process.nextTick
2752-
&& !(process as any).browser
2753-
&& typeof module === "object";
2752+
&& !(process as any).browser;
27542753
}

0 commit comments

Comments
 (0)