Conversation
TypeScript 7 dropped transpileModule/ModuleKind from the default export. Capacitor still resolves typescript from the project, so commands like bundle zip fail with Cannot read properties of undefined (reading 'CommonJS') and report a missing config file. When the project compiler no longer has the classic API, load the config with the CLI's own TypeScript instead of handing it to Capacitor. Fixes #3265
Load the CLI TypeScript fallback at runtime instead of bundling it, which embedded /home/runner/work/ paths in dist. Narrow loadConfigCap fallback to TS7-only projects, gate native .ts import on Bun/Node 22+, and add a native-import recovery test for requireTS failures. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
TypeScript 7 projects already return early via loadConfigTarget, so the catch fallback duplicated that path and hid real Capacitor errors. Node 20 keeps using requireTS with the CLI runtime TypeScript dependency; native import recovery stays gated to Bun and Node.js 22+. Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
|
@coderabbitai review |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
Merging this PR will degrade performance by 21.84%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | sha256 checksum for medium bundle payload |
1.3 ms | 1.7 ms | -21.84% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing cursor/fix-cli-typescript7-capacitor-config-8363 (0f842f8) with main (18f4717)
Footnotes
-
2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|



Summary (AI generated)
capacitor.config.tswhen the project uses TypeScript 7 (no classictranspileModule/ModuleKindAPI).Motivation (AI generated)
Capacitor resolves the project
typescriptpackage and callsModuleKind.CommonJSunguarded. TypeScript 7 removed that API, so CLI commands likebundle zipfail with misleading "missing config" errors (#3265).Business Impact (AI generated)
Restores Capgo CLI bundle/upload flows for customers on TypeScript 7 without forcing a TS downgrade.
Test Plan (AI generated)
bun run cli:build+bun run test:bundle(no/home/runner/work/in dist)bun run test:capacitor-config-typescript7bun run test:capacitor-config-native-importbun run test:init-monorepo-targetingRun CLI testsgreen on upstream branchSupersedes CI for fork PR: #3276
Generated with AI
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.