Version: v5
getSwcLoaderOptions
A helper function that creates SWC loader configuration options optimized for React Native bundling.
Info
This helper function is a part of getJsTransformRules.
Parameters
options
- Required:
true
Configuration options for SWC loader.
options.syntax
- Type:
"js" | "ts" - Required:
true
The source code syntax type.
options.jsx
- Type:
boolean - Required:
true
Whether to enable JSX/TSX parsing and transformation.
options.externalHelpers
- Type:
boolean - Default:
true
Whether to use external helpers for transformations.
options.jsxRuntime
- Type:
"automatic" | "classic" - Default:
"automatic"
The JSX runtime to use - 'automatic' for React 17+ new JSX transform or 'classic' for traditional JSX transform.
See SWC jsc.transform.react.runtime.
options.disableImportExportTransform
- Type:
boolean - Default:
false
Whether to disable transformation of import/export statements.
options.importSource
- Type:
string - Default:
"react"
The source module for JSX runtime imports.
See SWC jsc.transform.react.importSource.
options.lazyImports
- Type:
boolean | string[] - Default:
false
Enable lazy loading for all imports or specific modules.
See SWC module.lazy.


