Skip to content

fix(cli): load capacitor.config.ts on TypeScript 7 - #3279

Closed
riderx wants to merge 3 commits into
mainfrom
cursor/fix-cli-typescript7-capacitor-config-8363
Closed

riderx wants to merge 3 commits into
mainfrom
cursor/fix-cli-typescript7-capacitor-config-8363

Conversation

@riderx

@riderx riderx commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Summary (AI generated)

Motivation (AI generated)

Capacitor resolves the project typescript package and calls ModuleKind.CommonJS unguarded. TypeScript 7 removed that API, so CLI commands like bundle zip fail 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-typescript7
  • bun run test:capacitor-config-native-import
  • bun run test:init-monorepo-targeting
  • CI Run CLI tests green on upstream branch

Supersedes CI for fork PR: #3276

Generated with AI

Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

blehstbl and others added 3 commits September 8, 2026 15:25
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>
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

@codspeed

codspeed Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 21.84%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 42 untouched benchmarks
⏩ 2 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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. ↩

@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@riderx riderx closed this Sep 8, 2026

This branch was successfully deployed

1 active and 1 inactive deployments
deepsec-pr — 0f842f8b Deployed Sep 8, 2026 by riderx via Scan PR changes #6375
deepsec-fork-pr — 0f842f8b Deployed Sep 8, 2026 by cursor[bot] via Scan PR changes #6374
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.

3 participants