Re.Pack provides first-class support for React Native Reanimated through a dedicated plugin that simplifies integration and optimizes build performance.
The main purpose of this plugin is to limit the build performance impact of the react-native-reanimated
babel plugin.
If you're using webpack with babel-loader
, you probably don't need this plugin. Instead, you should follow the official Reanimated documentation and add the Reanimated Babel plugin directly to your babel.config.js
:
React Native Reanimated requires a special Babel plugin to transform your code, particularly functions marked with 'worklet'
.
This transformation is necessary but comes with a cost - the babel transformation can slow down your build process significantly
when applied to all files. With Rspack under the hood, we want to make sure that we use babel-loader
only as a last resort.
Our plugin takes a smarter approach by only applying the Reanimated transformation to files that actually need it:
worklet
In simple terms: we make your builds faster by only doing the heavy Reanimated processing where it's actually needed.
Shoutout to Nate Wienert who came up with a similar approach in one.dev - his work was the inspiration for this plugin.
If you haven't already, install the react-native-reanimated
package:
To add Reanimated support to your Re.Pack project with Rspack, install the plugin:
Add the plugin to your Rspack configuration file (rspack.config.js
):