Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,6 @@ hyperframes-bench/
tmp/
# Studio-generated preview thumbnails
.thumbnails/

# Local editor settings
.zed/
18 changes: 13 additions & 5 deletions packages/producer/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@ mkdirSync("dist", { recursive: true });

const scriptDir = dirname(fileURLToPath(import.meta.url));

// The banner provides a real `require` function via createRequire so that
// esbuild's CJS interop (__require) works correctly in ESM output.
// Without this, bundled CJS deps (recast, yauzl, etc.) that call
// require("fs") throw "Dynamic require of 'fs' is not supported".
// The banner provides a real `require` (via createRequire) plus the CJS-only
// `__filename`/`__dirname` globals so esbuild's CJS interop works in ESM output.
// Without `require`, bundled CJS deps (recast, yauzl, etc.) that call
// require("fs") throw "Dynamic require of 'fs' is not supported"; without the
// dirname shims, deps like wawoff2 throw "__dirname is not defined in ES module".
const cjsBanner = {
js: "import { createRequire as __cjsRequire } from 'module'; const require = __cjsRequire(import.meta.url);",
js: [
"import { createRequire as __cjsRequire } from 'module';",
"import { fileURLToPath as __cjsFileURLToPath } from 'url';",
"import { dirname as __cjsDirname } from 'path';",
"const require = __cjsRequire(import.meta.url);",
"const __filename = __cjsFileURLToPath(import.meta.url);",
"const __dirname = __cjsDirname(__filename);",
].join(" "),
};

const workspaceAliasPlugin = {
Expand Down
Loading