getSwcLoaderOptions
A helper function that creates SWC loader configuration options optimized for React Native bundling.
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.development
- Type:
boolean - Default: the build
modewhen used with Rspack'sbuiltin:swc-loader
Whether to apply JSX development transforms (jsxDEV, __source, __self), which give accurate component stacks and "open in editor" during development. When omitted, Rspack's builtin:swc-loader sets it from mode: true in development, false in production. With the automatic runtime, development builds then import <importSource>/jsx-dev-runtime; set it to false if your importSource doesn't provide one.
See SWC jsc.transform.react.development.
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.


