Oxc plugin options
The Oxc plugin is a Rust port of the Babel implementation of the Worklet Syntax plugin, built on top of Oxc. It's an opt-in alternative to the Babel plugin, which remains the default for the time being. Only Bundle Mode is supported.


Type definitions
interface PluginOptions {
extraPlugins?: string[];
extraPresets?: string[];
importForwarding?: {
moduleNames?: string[];
relativePaths?: string[];
};
silenceDangerousPathsWarning?: boolean;
}
Setup
For setup instructions, refer to the Bundle Mode setup with the Oxc plugin selected in the tabs.
How to use
Pass an object with the options to the plugin in your babel.config.js file. Pass the plugin and its options as a two-element array:
/** @type {import('react-native-worklets/plugin-oxc').PluginOptions} */
const workletsPluginOptions = {
importForwarding: {
moduleNames: ['my-library'],
},
};
module.exports = {
...
plugins: [
...
[
'react-native-worklets/plugin-oxc/babel',
workletsPluginOptions,
],
],
};
Options
importForwarding
Defaults to no forwarding (an empty object).
Configures import forwarding. It works the same way as the importForwarding option of the Babel plugin.
importForwarding.moduleNames
Defaults to an empty array.
Modules in this list are forwarded as imports inside worklet functions. The
module name has to be an exact match: with my-library in the list, imports from
my-library/some-file aren't forwarded. Only named and default
imports are forwarded; namespace imports such as
import * as lib from 'my-library' are captured from the closure instead. See
importForwarding.moduleNames of
the Babel plugin.
The Oxc plugin always forwards react-native-worklets and react-native/Libraries/Core/setUpXHR. The names in this list are added to them.
importForwarding.relativePaths
Defaults to an empty array.
List of paths that determine whether a module forwards its relative imports inside worklet functions. If the path of a module matches any of the paths, all relative imports inside the worklet functions of that module are forwarded. See importForwarding.relativePaths of the Babel plugin.
The Oxc plugin always does this for modules of react-native-worklets. The paths in this list are added to it.
A common folder name, such as src, also matches packages in node_modules that have a folder with that name. See the warning on the Babel plugin page.
silenceDangerousPathsWarning
Defaults to false.
Hides the warning that the plugin prints when an importForwarding.relativePaths entry has only common folder names, such as src. It works the same way as silenceDangerousPathsWarning of the Babel plugin.
extraPlugins
Accepted but ignored. The Oxc plugin cannot run other Babel plugins on worklet functions, so it prints a warning when this list is not empty. Add these plugins next to the Oxc plugin in your babel.config.js instead. See extraPlugins of the Babel plugin.
extraPresets
Accepted but ignored, in the same way as extraPlugins. See extraPresets of the Babel plugin.
Options that are always on
bundleMode and strictGlobal are always on and cannot be turned off.
Other Babel plugin options
The Oxc plugin ignores all other Babel plugin options.
Notes
Being a port, the Oxc plugin might not cover every edge case that the Babel plugin does. If you find a difference in behavior, please let us know on GitHub.