Skip to content

chore(producer): shim __filename/__dirname in the CJS banner#1553

Open
miguel-heygen wants to merge 1 commit into
mainfrom
chore/producer-esm-dirname-shim
Open

chore(producer): shim __filename/__dirname in the CJS banner#1553
miguel-heygen wants to merge 1 commit into
mainfrom
chore/producer-esm-dirname-shim

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Stack: foundation of the GSAP keyframe + motion-path editing feature (#1553#1561).

What

Extend the producer's ESM-output build banner to define the CJS-only __filename / __dirname globals (alongside the existing require shim), and gitignore local .zed/ editor settings.

Why

packages/producer is bundled to ESM, but several bundled CJS dependencies assume CommonJS globals. require was already shimmed; wawoff2 (WOFF2 font subsetting) additionally reads __dirname and throws __dirname is not defined in ES module at render time.

How

Build the banner from import.meta.url:

  • createRequire(import.meta.url)require
  • fileURLToPath(import.meta.url)__filename
  • dirname(__filename)__dirname

Test plan

  • bun run build (producer) succeeds
  • Manual render exercising font subsetting (wawoff2) no longer throws

Bundled CJS deps like wawoff2 call __dirname; without the shim they throw
"__dirname is not defined in ES module" at render time. Also ignore .zed/.
@miguel-heygen miguel-heygen force-pushed the chore/producer-esm-dirname-shim branch from 99da598 to e5e8d40 Compare June 18, 2026 15:17

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at e5e8d40c per Rames D Jusso + Via consolidated stack review. Tiny, mechanical CJS-banner shim for __filename / __dirname. No concerns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants