fix(producer): externalize postcss to fix ESM dynamic require

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) <noreply@anthropic.com>
This commit is contained in:
Miguel Ángel
2026-04-07 15:18:25 +00:00
committed by Miguel Ángel
co-authored by Claude Opus 4.6
parent f56b4c8620
commit 2bde83d5e3
+2 -2
View File
@@ -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,