Setup
Bundle Mode is the only mode of running worklets, so every native app using react-native-worklets has to be configured as follows:
Configure Worklet Syntax plugin
- Add the Worklet Syntax plugin to your Babel configuration. The Worklet Syntax plugin extracts each worklet function into a module that Worklet Runtimes load from your bundle.
- Babel plugin
- Oxc plugin
module.exports = {
presets: [
... // don't add it here :)
],
plugins: [
...
'react-native-worklets/plugin',
],
};
The plugin needs no options. See Options for what you can configure.
module.exports = {
presets: [
... // don't add it here :)
],
plugins: [
...
'react-native-worklets/plugin-oxc/babel',
],
};
The Oxc plugin needs no options either. See the Oxc plugin page.
If you use Expo, babel-preset-expo already adds the Worklet Syntax plugin on its own, without your options. With Reanimated installed, it adds the same plugin through react-native-reanimated/plugin. Turn both off in the preset, so the plugin doesn't run twice:
presets: [
['babel-preset-expo', { worklets: false, reanimated: false }],
],
Configure Metro
- Modify your Metro configuration. Metro needs to be configured to pre-load Bundle Mode entry points into your JavaScript bundle and to resolve the worklet modules the plugin emits. In your
metro.config.jsfile, apply the config required for Bundle Mode. For example:
- Expo
- React Native Community
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require("expo/metro-config");
const { getBundleModeMetroConfig } = require("react-native-worklets/bundleMode");
/** @type {import('expo/metro-config').MetroConfig} */
let config = getDefaultConfig(__dirname);
// Your modifications to the config
config = getBundleModeMetroConfig(config);
module.exports = config;
const {
getDefaultConfig,
mergeConfig,
} = require('@react-native/metro-config');
const { bundleModeMetroConfig } = require('react-native-worklets/bundleMode');
const config = {
// Your Metro config
};
module.exports = mergeConfig(
getDefaultConfig(__dirname),
bundleModeMetroConfig,
config
);
bundleModeMetroConfig sets serializer.polyfillModuleNames. mergeConfig replaces this array, it does not concatenate it. If your Metro config sets serializer.polyfillModuleNames too, use getBundleModeMetroConfig, which appends to your list:
const {
getDefaultConfig,
mergeConfig,
} = require('@react-native/metro-config');
const { getBundleModeMetroConfig } = require('react-native-worklets/bundleMode');
const config = {
// Your Metro config
};
module.exports = getBundleModeMetroConfig(
mergeConfig(getDefaultConfig(__dirname), config)
);
Use a Metro with inline modules
Worklets 1.0 requires a Metro that supports inline modules: Metro 0.88.0 or newer, together with React Native 0.89 or newer, whose @react-native/metro-babel-transformer passes the supportsInlineModules flag to Babel plugins.
Such a Metro supports metro:inline specifiers and virtual modules (react/metro#2037). The plugin emits each worklet module inline, as a require("metro:inline;base64,<module>") dependency of the file that defines the worklet, and Metro resolves it to a virtual module beside that file. Nothing is written to disk and Metro caches each worklet module like any other file. bundleModeMetroConfig and getBundleModeMetroConfig enable resolver.unstable_allowVirtualModules for you. No metro patch is needed.
Bundlers other than Metro
Under any other bundler, such as webpack, Turbopack or Babel run on its own, the plugin emits each worklet in place, as a factory function in the file that defines it. Nothing is written to disk and no module has to be resolved. Such a bundle has no Worklet Runtimes, so this output serves the web and tooling; running worklets on native requires Metro.
A library that precompiles its worklets this way must still let Metro transform its source, for example through the react-native or source field of its package.json. A worklet taken from such precompiled output has no module to load on a Worklet Runtime and fails with [Worklets] This worklet was compiled without Metro.
Enable fast refresh on Worklet Runtimes
This step is optional but highly recommended.
React Native's Fast Refresh (hot reload) feature doesn't apply to Worklet Runtimes out of the box. Therefore, when you change a worklet function's code you will see an error "[Worklets] Unable to resolve worklet from module ...".

This is due to the fact that the Fast Refresh update wasn't sent to the Worklet Runtime and it doesn't know that the module holding the new worklet function exists.
To fix this issue you can do one of the following:
- Reload the app on each worklet code change. This virtually defeats the purpose of Fast Refresh. Not recommended.
- Patch
metro-runtimepackage for it to send Fast Refresh updates to Worklet Runtimes. This is the recommended approach. This patch does not require building React Native from source. You can find the patch in Step 3 of the installation.
This patch is a temporary workaround until necessary changes are merged into Metro.
Final steps
Make sure to clear your Metro bundler's cache to ensure that all the changes are applied correctly.
- NPM
- YARN
npm start -- --reset-cache
yarn start --reset-cache
And that's it! You can now happily enjoy worklets! You can learn more about using Bundle Mode here.
Reference
To see how the setup looks in a real project, you can check out the Bundle Mode Showcase App repository.