Add tsx to EAS Build worker environment for TypeScript app.config.ts support
maloma7
Problem Statement
EAS Build workers don't include tsx in their environment, but Expo's official documentation recommends using tsx/cjs for TypeScript configuration files. This creates an inconsistent developer experience where following official best practices requires manual workarounds.
Current Official Documentation
Expo docs explicitly recommend using tsx/cjs at the top of app.config.ts:
import "tsx/cjs";
import type { ConfigContext, ExpoConfig } from "expo/config";
// ... rest of config
The Issue
When EAS Build attempts to evaluate app.config.ts, it fails with:
Cannot find module 'tsx/cjs'
This occurs because:
• @expo/config uses sucrase internally for TypeScript compilation
• User config files import tsx/cjs following official documentation
• EAS Build workers don't have tsx pre-installed
• Build fails before reaching dependency installation phase
Current Workaround Required
Developers must add a pre-install hook to their package.json:
"scripts": {
"eas-build-pre-install": "npm install -g tsx@4.20.5"
}
Use Case Details
• Project Type: React Native + Expo SDK 54 app
• TypeScript Config: Complex app.config.ts with multiple imports and conditional logic
• Following Best Practices: Using recommended tsx/cjs import per official docs
• Build Environment: EAS Build with development profile
• Package Manager: Bun (but affects all package managers)
Why This Should Be Included
• Documentation Consistency: Workers should support what the docs recommend
• Zero-Config Experience: Developers shouldn't need workarounds for documented patterns
• Common Use Case: Most TypeScript projects use tsx for config files
• Small Footprint: tsx is a lightweight addition to worker environment
• Industry Standard: tsx is the de-facto tool for running TypeScript in Node.js
Proposed Solution
Pre-install tsx in EAS Build worker environments alongside other essential tools like Node.js, npm/yarn, etc.
Impact: Eliminates need for workarounds and ensures seamless experience when following official Expo TypeScript documentation.
Environment
• Expo SDK: 54.0.6
• EAS CLI: 16.19.3
• React Native: 0.81.4
• TypeScript: 5.9.2
• Package Manager: Bun 1.2.22