Skip to content

Commit

Permalink
Fix again, exports is entirely reassigned, not augmented
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Feb 29, 2024
1 parent c798c02 commit 66ee8fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
};

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

// esbuild converts calls to "require" to "__require"; this function
// calls the real require if it exists, or throws if it does not (rather than
Expand Down
3 changes: 1 addition & 2 deletions src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2749,6 +2749,5 @@ export function isNodeLikeSystem(): boolean {
// and definitely exist.
return typeof process !== "undefined"
&& !!process.nextTick
&& !(process as any).browser
&& typeof module === "object";
&& !(process as any).browser;
}

0 comments on commit 66ee8fe

Please sign in to comment.