Skip to content

fix(cli): install what a Remix app imports, report a broken build, keep .wrangler out of git - #1031

Merged
edgar-durand merged 1 commit into
mainfrom
fix/preview-missing-imports-build-check
Nov 23, 2026
Merged

edgar-durand merged 1 commit into
mainfrom
fix/preview-missing-imports-build-check

Conversation

@edgar-durand

@edgar-durand edgar-durand commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Live on the owner's codespace (2.76.50), detection, wrangler and the tunnel all came up, but the page was white. Metro answered the bundle with 500 "Unable to resolve module expo-clipboard": the Remix players supply platform modules, so the exported package.json never declared it. The panel showed nothing, the post-turn card said "still responding", and .wrangler/ + .codeam/ showed up as 21 changed files.

What

  • missing-imports.ts: scans the app's bare imports (skips server/, node_modules, path aliases from tsconfig paths and babel module-resolver, and built-ins). Real npm packages that are neither declared nor installed get installed with the project's expo install … -- --legacy-peer-deps. This writes package.json, and the log says so.
  • bundle-health.ts: before preview_ready, Expo and Vite get the page and its entry script. A 4xx/5xx turns into preview_error "Your app didn't build:\n<Metro's message>" and stops the preview. A timeout is never reported as a failure.
  • .git/info/exclude gets /.wrangler/, /.codeam/*, !/.codeam/preview.json. The user's .gitignore is never touched. .wrangler/ is also added to the review-ignore list.

The post-turn "still responding" probe lives in api-v2 (GET /api/preview/sessions/:id/reachable) and is fixed in a separate codeagent-mobile PR.

Tests

New missing-imports-bundle-health.test.ts. Preview + turn-files suites: 568 passed. tsc is clean. Run live on a local Expo fixture: expo-clipboard was installed at ~8.0.8, the preview came up, and a missing module produced preview_error with Metro's text.

🤖 Generated with Claude Code


See it in action
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ep .wrangler out of git

- Before Expo starts, the app's code (not server/, node_modules) is scanned for
  bare imports that are neither declared nor installed (a Remix export: the
  players supply platform modules, so package.json missed expo-clipboard /
  expo-sqlite). Real npm packages are installed with `expo install` (SDK
  versions; this adds them to package.json, logged). Path aliases (tsconfig
  paths, babel module-resolver), built-ins and non-npm names are skipped.
- Before preview_ready, the page AND its entry script (Metro bundle / Vite
  module entry) are fetched: a build error is a preview_error with Metro's
  own message instead of a white page announced as ready. Slow is never broken.
- .wrangler/ and .codeam/ (but a committed .codeam/preview.json) go to
  .git/info/exclude, never the user's .gitignore; .wrangler/ is also in the
  review-ignore list so the change card doesn't count it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@edgar-durand
edgar-durand merged commit 95f46ee into main Nov 23, 2026
7 checks passed
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.

2 participants