@tsrx/bun-plugin-react
v0.1.104
Published
Bun plugin for @tsrx/react (.tsrx modules)
Keywords
Readme
@tsrx/bun-plugin-react
Bun plugin for compiling @tsrx/react .tsrx files.
Installation
pnpm add -D @tsrx/bun-plugin-reactUsage
import tsrxReact from '@tsrx/bun-plugin-react';
await Bun.build({
entrypoints: ['./src/App.tsrx'],
outdir: './dist',
target: 'browser',
plugins: [tsrxReact()],
});The plugin compiles .tsrx modules with @tsrx/react, runs Bun's TSX transform
for React's automatic JSX runtime, and emits sibling-scoped <style> blocks (each
styles its siblings and everything below them) as virtual CSS modules.
For bun:test, register it from a preload:
import tsrxReact from '@tsrx/bun-plugin-react';
Bun.plugin(tsrxReact());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 Bun's selected/nearest tsconfig, includingextends. An override must match tsconfig. ForBun.build, all three exact flags are defined and conflicting definitions are rejected.emitCss: whether to emit virtual CSS imports (default:true).include,exclude: regex filters for source files.
When using runtimeImports: 'direct', install the runtime as a direct production
dependency of the package that owns the compiled modules:
pnpm add @tsrx/react-runtimeBun may bundle the helpers into its output, but this plugin only emits bare
@tsrx/react-runtime/* imports and does not provide the runtime package.
