Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Integrating React Compiler + Tamagui in Expo 53#3605

smhutch started this conversation inGeneral
Discussion options

Background

  • I upgraded to Expo 53 this week, and thankfully I didn't run into the same issues that a few other people seem to be hitting (🐞 Can't find tamagui configuration after upgrading to Expo SDK 53 #3569).
  • While upgrading, I intentionally did'nt enable either React Compiler or the new React Native Architecture.
  • After getting to v53, I isolated a change to enable React Compiler.
  • When enabling the compiler, following the docshere I started to run into the sameCan't find Tamagui configuration error that others have reported.
  • I discoverd that I could consistently use the app withreactCompiler:false, but setting it totrue broke by app due to this Tamagui error.

Resolution

I was able to resolve this (and enable React compiler) by taking the following steps:

  1. reactCompiler: false in my Expo app config.
  2. Avoid configuringreactCompiler via 'babel-preset-expo'
  3. Manually configure the react compiler babel plugin, by adding itbelow my Tamagui plugin in my babel config.

Below is an example of my final babel config:

module.exports=(api)=>{api.cache(false);return{presets:[['babel-preset-expo',{reanimated:true,//@see https://docs.reown.com/appkit/react-native/core/installation#create-babel-config-jsunstable_transformImportMeta:true,/**           * Note: React compiler can be enabled here, but the beta version is incompatible with tamagui/babel-plugin           */},],],plugins:[['@tamagui/babel-plugin',{components:['tamagui'],config:'./tamagui.config.ts',logTimings:true,disableExtraction:false,},],],overrides:[{/**         * Note: This can also be configured via the babel-preset-expo preset.         * When doing so (v53), this conflicted with the tamagui/babel-plugin.         *         * For this reason, we're configuring it manually here instead.         */test:/\.(ts|tsx)$/,plugins:[['babel-plugin-react-compiler',{compilationMode:'infer',panicThreshold:'none',target:'19',/**               * Use this callback to determine if the file should be processed by the react compiler.               *               * This is called for every TS file in the project.               */sources:(filename)=>{// filter out files in node_modules + generated code.},logger:{logEvent(filename,event){// basic logging},},},],],},],};};

My understanding here is that the order of plugins matter. Both Tamagui and react-compiler arechanging my React source code. I suspect that one or more of the packages doesn't like being in the wrong order.

Additional context

  • I also shared this issue with the Expo team on Discord (link).
  • I agree with them that it's not really an Expo problem, and it's not really a Tamagui problem either because I found a suitable workaround. It's more of an intergration issue between two popular tools.
  • React compiler is still considered beta (and experimental by Expo), but I believe they are going to make it on by default in the next major release (v54).
  • I suspect when they do, you'll get more reports of this being an issue, and it might even lead people to believe that Tamagui doesn't work with it at all.
  • I think it would be helpful to provide a suggested way to integrate react compiler with the tamagui compiler.
You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

As part of my debugging into this, I tried the following cases.

Only the first and last case worked.

Every attempt to use the Expo preset failed.

react-compiler enabled in app.configreact-compiler compilationModereact-compiler sourcestamagui babel plugin?tamagui extraction enabled?ResultNote
infern/aThe app works without react compiler. 
infernone💥App crashes
infernone💥App crashes
infernonen/a💥 App crashes
annotationnone💥App crashes, even when using opt-in mode + disabling all sources from being processed
infernoneI was able to get the compiler enabled by using the babel plugin
You must be logged in to vote
1 reply
@XChikuX
Comment options

Thank you for this!!

In case anyone else runs into this.

Downgrading to Version1.129.19 also seems to fix the issue.

You can probably try your luck with SDK54 as well.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
2 participants
@smhutch@XChikuX

[8]ページ先頭

©2009-2025 Movatter.jp