Skip to content

fix(cli): don't crash on TypeScript 7; lazy-load rollup transpile stack - #4877

Open
furuchanchan wants to merge 1 commit into
tscircuit:mainfrom
furuchanchan:fix/ts7-transpile-crash
Open

furuchanchan wants to merge 1 commit into
tscircuit:mainfrom
furuchanchan:fix/ts7-transpile-crash

Conversation

@furuchanchan

Copy link
Copy Markdown

Summary

  • cli/build/transpile/index.ts eagerly imported rollup, @rollup/plugin-typescript, and typescript at module scope, so every tsci command (even --version) crashed in projects with typescript@7 — the plugin reads ts.ModuleKind.ES2015, which the TS7 native port removed
  • The rollup bundler stack is now loaded lazily inside transpileFile, and the installed TypeScript is validated first; unsupported versions fail with an actionable message (Pin typescript@^5 ...) instead of a TypeError at startup
  • Added typescript@5.9.3 as an explicit devDependency since the code imports it directly

Verified:

  • typescript@7.0.2 installed: tsci --version works, transpileFile returns false with the actionable error (was: hard crash)
  • typescript@5.9.3: transpile produces index.js/index.cjs/index.d.ts as before; bun test tests/cli/transpile 6/6 pass, tests/cli/build 12/12 pass

Closes #4706

@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

The eager import of @rollup/plugin-typescript at module scope crashed every
tsci command (including --version) in projects with typescript@7 installed,
because the plugin reads ts.ModuleKind.ES2015 which the TS7 native port
removed.

Defer loading rollup/plugin-typescript/etc into transpileFile, and check the
installed compiler first so unsupported versions fail with an actionable
message instead of a startup TypeError.
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI crashes at startup with TypeScript 7: @rollup/plugin-typescript reads undefined ModuleKind.ES2015

1 participant