@tsrx/rspack-plugin-react
v0.0.107
Published
Rspack plugin for @tsrx/react
Downloads
2,306
Keywords
Readme
@tsrx/rspack-plugin-react
Rspack plugin for compiling @tsrx/react .tsrx files.
Installation
pnpm add -D @tsrx/rspack-plugin-reactUsage
import { TsrxReactRspackPlugin } from '@tsrx/rspack-plugin-react';
export default {
plugins: [new TsrxReactRspackPlugin()],
};The plugin compiles .tsrx modules with @tsrx/react, chains
builtin:swc-loader for React's automatic JSX runtime, and emits sibling-scoped
<style> blocks (each styles its siblings and everything below them) through
Rspack's built-in CSS module type.
It also pushes .tsrx into resolve.extensions and enables experiments.css
when unset.
Options
jsxImportSource: automatic JSX runtime import source (default:'react').runtimeImports: helper import mode ('compiler'by default, or'direct'for standalone runtime imports).platform: optional override/fallback for the compile-time platform. Normally the plugin readstsrx.platformfrom the project tsconfig (includingresolve.tsConfigandextends). An override must match tsconfig. The plugin defines all three exact flags and rejects conflicting Rspack definitions.
When using runtimeImports: 'direct', install the runtime as a direct production
dependency of the package that owns the compiled modules:
pnpm add @tsrx/react-runtimeThe plugin only emits bare @tsrx/react-runtime/* imports and does not provide
the runtime package.
