Metro Guide
How to set up Tamagui with Metro
Expo’s default Metro configuration runs Tamagui directly, with an optional plugin for config loading and CSS extraction.
Basic Setup
The default Expo Metro configuration works out of the box:
metro.config.js
With Metro Plugin (Recommended)
For better dev experience, use the Metro plugin, which loads your Tamagui
config and watches for changes. It ships inside @tamagui/cli along with the
CLI and the other bundler integrations:
yarn
npm
bun
pnpm
If Metro is the only bundler this project will ever use, yarn add @tamagui/metro-plugin on its own is a smaller install and exports exactly the
same things.
If you have a tamagui.build.ts (recommended; see
compiler install docs),
no options are needed:
metro.config.js
Or pass options inline:
metro.config.js
Optimized Production Builds
For maximum optimization, use the tamagui build command which pre-compiles
your components:
Terminal
The -- syntax runs the command after optimization, then automatically restores
your source files. Add this to your package.json:
Debugging
To debug the compiler output, add // debug at the top of a file:
This will print detailed compiler output showing what optimizations are happening:
Use // debug-verbose for even more detailed output.