diff options
author | 2023-07-12 15:21:55 -0700 | |
---|---|---|
committer | 2023-07-12 15:21:55 -0700 | |
commit | ae0a724981dd70f457d83f5f134e10dfbc7f72c5 (patch) | |
tree | fc094d1176c60a3378dab270264be3352d11ea87 /src/js/build-esm.ts | |
parent | 0631f878667d9a5cab80d7c1167eac7cbc1c93c6 (diff) | |
download | bun-ae0a724981dd70f457d83f5f134e10dfbc7f72c5.tar.gz bun-ae0a724981dd70f457d83f5f134e10dfbc7f72c5.tar.zst bun-ae0a724981dd70f457d83f5f134e10dfbc7f72c5.zip |
Improve our internal typedefs (#3608)
* types
* some more
* yeah
* i think that fixes it
* oop
Diffstat (limited to 'src/js/build-esm.ts')
-rw-r--r-- | src/js/build-esm.ts | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/js/build-esm.ts b/src/js/build-esm.ts index 8cdca3688..5e974e7da 100644 --- a/src/js/build-esm.ts +++ b/src/js/build-esm.ts @@ -52,6 +52,7 @@ const opts = { define: { "process.platform": JSON.stringify(process.platform), "process.arch": JSON.stringify(process.arch), + "$lazy": "$$BUN_LAZY$$", }, } as const; @@ -111,7 +112,9 @@ for (const [build, outdir] of [ fs.mkdirSync(path.join(outdir, path.dirname(output.path)), { recursive: true }); if (output.kind === "entry-point" || output.kind === "chunk") { - const transformedOutput = (await output.text()).replace(/^(\/\/.*?\n)+/g, ""); + const transformedOutput = (await output.text()) + .replace(/^(\/\/.*?\n)+/g, "") + .replace(/\$\$BUN_LAZY\$\$/g, 'globalThis[Symbol.for("Bun.lazy")]'); if (transformedOutput.includes("$bundleError")) { // attempt to find the string that was passed to $bundleError |