Skip to content

Commit c798c02

Browse files
committed
Document it
1 parent d47cef2 commit c798c02

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Herebyfile.mjs

+3
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ 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`
213+
// but then does not use it, instead using the `ts` variable. Ensure that if we think we're CJS
214+
// that we still set `ts` to the module.exports object.
212215
options.footer = { js: `})(typeof module !== "undefined" && module.exports ? (ts = module.exports, module) : { exports: ts });` };
213216

214217
// esbuild converts calls to "require" to "__require"; this function

0 commit comments

Comments
 (0)