If the automatic migration using @callstack/repack-init
didn't work for any reason,
or if you have custom project structure, you can follow these manual migration steps:
Install required dependencies in your project:
This will install the latest versions of your chosen bundler and necessary dependencies for code optimization and minification.
Once the dependencies are installed, you need to tell React Native Community CLI to add Re.Pack's commands.
Add the following content to react-native.config.js
(or create it if it doesn't exist):
This will allow you to use Re.Pack when running react-native start
and react-native bundle
commands.
Pick one of the templates below and create configuration file in the root directory of your project. The name of the file should be identical to the one on top of the template e.g. rspack.config.mjs
.
We recommend to use ESM version of Rspack/webpack config with the .mjs
extension. However, Re.Pack also supports ESM under .js
and CJS variant under .js
and .cjs
extensions. Check our templates for CJS and ESM variants as well as the documentation on Configuration to see the list of all available Rspack/webpack config location and extensions.
When building release version of your application XCode project will still use Metro to bundle the application, so you need to adjust build settings to make XCode use Re.Pack instead.
Open your application's Xcode project/workspace and:
After the change, the content of this phase should look similar to:
For iOS development, you need to install CocoaPods dependencies. From the project root directory run:
This will install all the necessary iOS dependencies for your project, including the Re.Pack native module.
You've successfully set up Re.Pack in your project. We highly recommend to check out the following: