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] 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 2f497a6bd..8d1bcfede 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,