Known limitations:
- You'll need a recent React Native version
- The compatibility between esbuild's output and React Native's JS runtimes is not clear yet, some JS features may break everything
- Some very useful features like stack trace symbolication are not yet implemented
- A dev server that runs all day long without getting in your way. It should handle things like branch switches,
yarn install
smoothly and you should never wait for it - Fast bundling (a few seconds) so that JS deploys (codepush, expo...) are fast
- Smaller and faster prod bundles thanks to tree-shaking and ES modules scope-hoisting
Node >= 16 is required.
This package is not yet published to npm.
git clone [email protected]:matthieugicquel/tgv.git
cd tgv
yarn
yarn link
cd <the RN repo you want to test it with>
Add to package.json:
"devDependencies": {
"tgv": "file:<path-to-tgv>"
}
Add .tgv-cache
to .gitignore
cd <the RN repo you want to test it with>
yarn link tgv
yarn
Then add to react-native.config.js: (or create it)
module.exports = {
commands: require('tgv/commands')({
async plugins() {
const {flow} = await import('tgv/plugins/flow');
const {reanimated} = await import('tgv/plugins/reanimated');
return [flow(), reanimated()];
},
}),
};
Note: This looks a bit complicated. The reason is that tgv is written and published as esm, while react-native cli is not yet. You have to use await import
for the plugins to load
# This starts a dev server that replaces metro, do it before `run-x` so that metro doesn't start automatically
yarn react-native tgv-start
yarn react-native run-(ios|android)
Add export BUNDLE_COMMAND=tgv-bundle
to the "Bundle react native code and images" script in Xcode for the app target:
// android/app/build.gradle
project.ext.react = [
// ...
bundleCommand: 'tgv-bundle'
]
Only this README for now yet, but some research is here: