Rolldown plugin for the React Signals transform.
It applies the Signals React transform during Rolldown builds with Rolldown's native magic string pipeline, so React components and hooks can automatically subscribe to signal reads without wiring Babel up manually.
pnpm add -D @rolldown/plugin-react-signals-transform
pnpm add react @preact/signals-reactimport reactSignalsTransform from '@rolldown/plugin-react-signals-transform'
export default {
plugins: [
reactSignalsTransform({
mode: 'auto',
}),
],
}This plugin forwards the same options as @preact/signals-react-transform:
modeimportSourcedetectTransformedJSXexperimental
Example:
reactSignalsTransform({
detectTransformedJSX: true,
experimental: {
debug: true,
},
})- Run it before other JSX transforms.
- The generated code imports
useSignalsfrom@preact/signals-react/runtimeby default. - When your code is already compiled to
react/jsx-runtimeorReact.createElement, enabledetectTransformedJSX.
MIT
The transform logic is adapted from packages/react-transform in the Preact Signals repository. The test cases are ported from the same package.