Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expo 52 #1248

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Expo 52 #1248

wants to merge 10 commits into from

Conversation

czystyl
Copy link

@czystyl czystyl commented Nov 18, 2024

Update the Mobile app to use Expo v52 and related packages.

Additionally:

@czystyl czystyl changed the title Update mobile app to Expo52 Expo 52 Nov 18, 2024
@kiikoh
Copy link

kiikoh commented Nov 18, 2024

EXPO_USE_METRO_WORKSPACE_ROOT is now enabled by default. The monorepo root is considered to "contain all content", the workspace root adds something called "server root" besides the "project root". This fixes a couple of things related to: resolution to workspaces in the monorepo, splitting the Metro cache for near-identical apps in the same monorepo, using the correct entry point resolution in various cases.
Metro will now be automatically configured to support pnpm monorepos. Learn more.

From: https://expo.dev/changelog/2024/11-12-sdk-52

Is there any simplifications that can be made to the metro configuration as a result of this? Can hoist be removed?

@VaniaPopovic
Copy link
Contributor

VaniaPopovic commented Nov 18, 2024

Can we bump nativewind + remove "react-native-css-interop": "~0.0.36", as part of this? Nativewind 4.1.x contains a lot of fixes

P.S think there are some changes in expo-splash-screen as well

@czystyl
Copy link
Author

czystyl commented Nov 19, 2024

Can we bump nativewind + remove "react-native-css-interop": "~0.0.36", as part of this? Nativewind 4.1.x contains a lot of fixes

P.S think there are some changes in expo-splash-screen as well

Is react-native-css-interop not needed anymore?

@czystyl
Copy link
Author

czystyl commented Nov 19, 2024

EXPO_USE_METRO_WORKSPACE_ROOT is now enabled by default. The monorepo root is considered to "contain all content", the workspace root adds something called "server root" besides the "project root". This fixes a couple of things related to: resolution to workspaces in the monorepo, splitting the Metro cache for near-identical apps in the same monorepo, using the correct entry point resolution in various cases.
Metro will now be automatically configured to support pnpm monorepos. Learn more.

From: https://expo.dev/changelog/2024/11-12-sdk-52

Is there any simplifications that can be made to the metro configuration as a result of this? Can hoist be removed?

I don't see anything that can be simplified at this moment. I'm upgrading two other production apps that use monorepo, so If anything pops up, I'll transfer it here as well.

@czystyl czystyl marked this pull request as draft November 19, 2024 11:20
@czystyl
Copy link
Author

czystyl commented Nov 19, 2024

I've encountered development build problems, so converting the PR back to draft.

@juliusmarminge
Copy link
Member

we should be able to remove the hoisting now right? Expo 52 promised to fix monorepos 🤞🏼

Copy link
Member

@juliusmarminge juliusmarminge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VaniaPopovic will run some sanity checks tomorrow (potentially add back granular hoisting since EAS might not play nice otherwise) but LGTM :)

@czystyl
Copy link
Author

czystyl commented Nov 27, 2024

@VaniaPopovic will run some sanity checks tomorrow (potentially add back granular hoisting since EAS might not play nice otherwise) but LGTM :)

Thanks @juliusmarminge, for jumping in!

I've had weird issues with the build itself, but let me know if you need anything else to test.

@kiikoh
Copy link

kiikoh commented Nov 27, 2024

FWIW: I also had issues applying these changes to my t3-turbo project but had problems getting it to build properly. Although its very possible that my issues are from the additional packages I've added

@czystyl
Copy link
Author

czystyl commented Dec 5, 2024

I've tested the build after @juliusmarminge changes, and it works like a charm!

@kiikoh
Copy link

kiikoh commented Dec 7, 2024

I had problems building with the hoist option disabled, adding it back allowed it to work

@czystyl
Copy link
Author

czystyl commented Dec 8, 2024

From today's testing (iOS builds):

  • Local builds (using Xcode) works without node-linker=hoisted
  • EAS builds breaks without node-linker=hoisted

Eas logs:

▸ ** BUILD FAILED **
▸ The following build commands failed:
▸ 	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/workingdir/build/apps/expo/ios/build/Build/Intermediates.noindex/expo.build/Release-iphonesimulator/expo.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'expo' from project 'expo')
▸ 	Building workspace expo with scheme expo and configuration Release
▸ (2 failures)
** BUILD FAILED **
The following build commands failed:
	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/workingdir/build/apps/expo/ios/build/Build/Intermediates.noindex/expo.build/Release-iphonesimulator/expo.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'expo' from project 'expo')
	Building workspace expo with scheme expo and configuration Release
(2 failures)
Exit status: 65```

@RobSchilderr
Copy link

Really looking forward to spend some time in christmas playing around with SDK 52! What's the status of this issue? I saw that the core of tRPC was bumped to 19 already

@czystyl
Copy link
Author

czystyl commented Dec 18, 2024

@juliusmarminge From my test we'll need to bring back the hoisting because of ESA - it's not working well :D

@adriangonzy
Copy link

Hey guys ! I was able to have expo sdk 52 with react 18.3.1 and the new Arch on the expo app and react 19 every where else.

I had to change the package.json at the root on the CI like this:

      - name: PreInstall forcing React 18.3.1 on Mobile
        run: |
          rm pnpm-lock.yaml && 
          jq '.pnpm.overrides = {
            "react": "18.3.1",
            "react-dom": "18.3.1",
            "@types/react": "18.3.16",
            "@types/react-dom": "18.3.1"
          }' package.json > temp.json && mv temp.json package.json

I am forced to delete the lock file so the override works and we only have this react version when bundling the app.

The rest of the puzzle is as you described:

  • using catalogs for the react versions so we avoid mistmatched versions of react on installation.
  • no hoisting when working locally. I think its possible to make it work locally with hoisting but it might require some extra work on the metro resolver config.
  • changing the hoisting on the CI when building -> like this:
      - name: Force hoisting on CI
        run: mv .npmrc-ci .npmrc && pnpm install

And .npmrc-ci has:

node-linker=hoisted
link-workspace-packages=true

Thanks for the many pieces that helped me get to this hacky solution waiting for react 19 to be officially supported on react native projects.

I also managed to upgrade Next to version 15 as I integrated payloadCMS v3 too.

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.

bug: Readme schema link is broken
6 participants