getFlowTransformRules
A helper function that generates module.rules configuration for handling Flow type annotations in JavaScript files. The rules use @callstack/repack/flow-loader to remove Flow types from the code before other processing.
This helper function is a part of getJsTransformRules.
This helper function is only relevant when using Rspack as your bundler. If you are using webpack with babel, you don't need to use this helper function, since it's already included as part of @react-native/babel-preset.
Parameters
options
- Required:
false
Configuration options for Flow transformations
options.include
- Type:
string[] - Default: predefined set of React Native libraries that use Flow
Array of module names to include for Flow transformation.
Pass module names as they appear in package.json. You can use full package names or scopes.
options.exclude
- Type:
string[] - Default:
[]
Array of module names to exclude from Flow transformation.
Pass module names as they appear in package.json. You can use full package names or scopes.
options.all
- Type:
boolean - Default:
true
Whether to bypass looking for @flow pragma comment before parsing
options.ignoreUninitializedFields
- Type:
boolean
Whether to remove uninitialized class fields completely rather than only removing the type (defaults to false)
options.removeEmptyImports
- Type:
boolean - Default:
true
Whether to remove empty import statements which were only used for importing flow types (defaults to true)


