feat(expo): add first-class Re.Pack integration - #1425
Conversation
|
|
@whydidoo is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
|
@whydidoo can you check the merge conflicts? |
| "expo-router": "~56.2.7", | ||
| "expo-status-bar": "~56.0.4", | ||
| "react": "19.2.3", | ||
| "react-native": "0.85.3", |
There was a problem hiding this comment.
I recently updated our react native version to "0.86.0"
also note that we have some of our package versions in catalogs in pnpm workspace
would be good to keep react native versions in sync across projects I think
There was a problem hiding this comment.
Expo SDK 57 currently expects React Native 0.86.2 and React 19.2.3.
I’ve kept both Expo examples on the same Expo-compatible versions rather than forcing the default catalog versions. We could add a dedicated Expo SDK 57 catalog later to keep those versions centralized as well.
|
lets try and align the Expo package and examples with the workspace catalogs At the moment the new Expo projects use direct pins for React, React Native, Community CLI packages, the React Native Babel preset, React types, TypeScript, and Module Federation, while existing testers use the shared catalog entries. In particular, the Expo apps use React Native 0.86.2 while the catalog is 0.86.0; if 0.86.2 is the Expo 57-compatible version, please update the shared React Native catalog to 0.86.2 and have the relevant examples consume it through the catalog. The Expo SDK packages themselves can live in a dedicated Expo 57 catalog, shared by both Expo fixtures, so their versions do not drift. The same applies to any Expo-specific React, CLI, or Babel compatibility pins that genuinely cannot use the default catalog. regarding typescript version I have a separate pr that updates typescript to v7 which we could merge before this and then update those expo projects to be on v7 as well |
| } | ||
|
|
||
| export function configureExpoRouterEntry( | ||
| rules: unknown[], |
There was a problem hiding this comment.
| rules: unknown[], | |
| rules: RuleSetRule[], |
| resolvedEntry.projectRoot | ||
| ); | ||
| const caller = createExpoBabelCaller({ | ||
| isDev: compiler.options.mode === 'development', |
There was a problem hiding this comment.
| isDev: compiler.options.mode === 'development', | |
| isDev: compiler.options.mode !== 'production', |
Since export type Mode = "development" | "production" | "none"; when someone will set none then will take production behaviour. Not sure if it's in purpose
|
|
||
| const ANDROID_MAIN_MODULE_TAG = 'repack-expo-android-main-module'; | ||
| const ANDROID_BUNDLE_COMMAND_TAG = 'repack-expo-android-bundle-command'; | ||
| const EXPO_CLI_BLOCK = ` // Use Expo CLI to bundle the app, this ensures the Metro config |
There was a problem hiding this comment.
I think that instead of matching the entire block character-by-character we could use RegExp with tolerance for whitespace. Both here (EXPO_CLI_BLOCK) and in ios.ts (EXPO_CLI_DEFAULTS)
| if ( | ||
| parent === current || | ||
| fs.existsSync(path.join(current, '.git')) || | ||
| fs.existsSync(path.join(current, 'pnpm-workspace.yaml')) |
There was a problem hiding this comment.
| fs.existsSync(path.join(current, 'pnpm-workspace.yaml')) | |
| fs.existsSync(path.join(current, 'pnpm-workspace.yaml')) || | |
| (currentPackageJson && 'workspaces' in currentPackageJson) |
Summary
This PR introduces first-class Expo support for Re.Pack through a new
@callstack/repack-expopackage.It allows Expo SDK 56 applications using prebuild/CNG to use Rspack and the existing Re.Pack runtime, including ScriptManager and Module Federation v2, without changing the core Re.Pack packages.
The package remains private while we validate the initial integration contract.
What’s included
ExpoPluginfor Rspack that owns the required Expo/Re.Pack defaults:EXPO_PUBLIC_*environment variablesnpx @callstack/repack-expo initnpx @callstack/repack-expo doctorModule Federation v2
Module Federation remains explicit and application-owned, matching regular Re.Pack behavior.
The implementation supports:
React.lazy()chunks alongside remote widgetsRemote widgets cannot provide native dependencies. Native modules must already be installed and linked in the host application.
Native integration
@callstack/repack-expo initonly updates application-owned configuration.Native changes are applied through the Expo Config Plugin during
expo prebuild. The integration does not require users to maintain custom Swift, Kotlin, Gradle or Xcode changes manually.Development applications are launched with:
npm run repack:start npm run repack:ios # or npm run repack:android