Add a comment

This commit is contained in:
Jarred Sumner
2022-10-12 18:09:04 -07:00
parent a97914fff3
commit 3a042cdb48

View File

@@ -1403,6 +1403,16 @@ pub fn NewPrinter(
const record = p.import_records[import_record_index];
if (comptime is_bun_platform) {
// "bun" is not a real module. It's just globalThis.Bun.
//
// transform from:
// const foo = await import("bun")
// const bar = require("bun")
//
// transform to:
// const foo = await Promise.resolve(globalThis.Bun)
// const bar = globalThis.Bun
//
if (record.tag == .bun) {
if (record.kind == .dynamic) {
p.print("Promise.resolve(globalThis.Bun)");