Rollup plugin to alias 'react', 'react-dom', and related modules to Preact ('preact/compat' or 'preact-compat') with configurable options like React-like compatibility flags (usePreactX, noPropTypes, etc.). Version 0.1.1 (first stable release), low release cadence. Key differentiator: provides a one-stop Rollup integration for swapping React with Preact's compat layer, supporting aliasModules for custom mappings. Alternatives like @rollup/plugin-alias require manual configuration.
npm install rollup-plugin-react-compatVerified import paths — ran on the pinned version, not inferred.
Configures Rollup to alias React modules to Preact's compat layer with custom aliases.
npm install preact preact-compat
Set only one of them to true, or ensure your configuration is mutually exclusive.
Ensure your codebase is compatible with Preact's compat layer.
Replace 'usePreactCompat: true' with 'useReactCompat: true'.
Run 'npm install preact-compat' and ensure it's listed in your package.json.
Use 'import reactCompat from 'rollup-plugin-react-compat'' (default import).
Change 'usePreactCompat: true' to 'useReactCompat: true' in the plugin options.