Skip to content

fix: externalize CJS deps (ink, react, dotenv) from ESM bundles#493

Merged
FL4TLiN3 merged 1 commit intomainfrom
fix/create-expert-externalize-runtime
Feb 14, 2026
Merged

fix: externalize CJS deps (ink, react, dotenv) from ESM bundles#493
FL4TLiN3 merged 1 commit intomainfrom
fix/create-expert-externalize-runtime

Conversation

@FL4TLiN3
Copy link
Contributor

Summary

  • Externalize ink, react, dotenv by adding them to dependencies in both perstack and create-expert
  • Externalize @perstack/runtime in create-expert (already done in perstack)
  • Remove react-devtools-core from tsup external (no longer needed — ink is externalized)
  • Update knip config to ignore these transitive runtime deps

Root cause

tsup bundles devDependencies into ESM output. CJS modules (signal-exit@3.0.7, stack-utils@2.0.6, dotenv@17.2.3) use require("path") etc., which fails in ESM bundles because tsup's CJS shim can't resolve Node.js builtins.

Result

  • Zero __require() calls in both bundles
  • create-expert: 4MB → 145KB
  • perstack: similarly reduced
  • No banner/createRequire hacks

🤖 Generated with Claude Code

Move ink, react, dotenv, and @perstack/runtime to dependencies in both
perstack and create-expert so tsup externalizes them instead of bundling.
This eliminates CJS require("path") errors from signal-exit, stack-utils,
and dotenv when running the published ESM bundles.

Bundle sizes: create-expert 4MB→145KB, perstack similarly reduced.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@FL4TLiN3 FL4TLiN3 enabled auto-merge (squash) February 14, 2026 11:06
@FL4TLiN3 FL4TLiN3 merged commit 0f7082b into main Feb 14, 2026
9 checks passed
@FL4TLiN3 FL4TLiN3 mentioned this pull request Feb 14, 2026
@FL4TLiN3 FL4TLiN3 deleted the fix/create-expert-externalize-runtime branch February 25, 2026 13:35
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.

1 participant