From 2bde83d5e36eb77cb46931b8a360e25d4c607dd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Tue, 7 Apr 2026 02:50:51 +0200 Subject: [PATCH 1/2] fix(producer): externalize postcss to fix ESM dynamic require MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit postcss is a CJS module that uses `require("path")` internally. When esbuild bundles it into the ESM producer output, the dynamic require call fails at runtime with "Dynamic require of path is not supported". This broke `npx tsx cli render` and `npx tsx cli preview` from the local dev build. Fix: add postcss to the external list alongside puppeteer and esbuild — it stays as a runtime dependency resolved from node_modules instead of being bundled. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/producer/build.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/producer/build.mjs b/packages/producer/build.mjs index 2f497a6b..8d1bcfed 100644 --- a/packages/producer/build.mjs +++ b/packages/producer/build.mjs @@ -36,7 +36,7 @@ await Promise.all([ platform: "node", target: "node22", format: "esm", - external: ["puppeteer", "esbuild"], + external: ["puppeteer", "esbuild", "postcss"], plugins: [workspaceAliasPlugin], minify: false, sourcemap: true, @@ -48,7 +48,7 @@ await Promise.all([ platform: "node", target: "node22", format: "esm", - external: ["puppeteer", "esbuild"], + external: ["puppeteer", "esbuild", "postcss"], plugins: [workspaceAliasPlugin], minify: false, sourcemap: true, From 6cd6514daaccdd65b7a783f3f28d9e96603a7120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Tue, 7 Apr 2026 02:53:23 +0200 Subject: [PATCH 2/2] fix(producer): extract head styles/scripts from non-template sub-compositions Mirrors the runtime compositionLoader fix: the producer's inlineSubCompositions() was parsing only `bodyEl.innerHTML`, discarding all content. CSS backgrounds, positioning, fonts, and library scripts (GSAP CDN) defined in were silently dropped during compilation. Also externalizes postcss in the esbuild config to fix "Dynamic require of path is not supported" error that broke local dev rendering via `npx tsx cli render`. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../producer/src/services/htmlCompiler.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/producer/src/services/htmlCompiler.ts b/packages/producer/src/services/htmlCompiler.ts index 7ac6a0b5..a737d6f2 100644 --- a/packages/producer/src/services/htmlCompiler.ts +++ b/packages/producer/src/services/htmlCompiler.ts @@ -525,6 +525,31 @@ function inlineSubCompositions( : contentDoc.querySelector("[data-composition-id]"); const inferredCompId = innerRoot?.getAttribute("data-composition-id")?.trim() || null; + // When a sub-composition is a full HTML document (no