close
logologo
Guide
Config
Plugin
API
Community
Version
Changelog
Rsbuild 0.x Doc
English
简体中文
Guide
Config
Plugin
API
Community
Changelog
Rsbuild 0.x Doc
English
简体中文
logologo

Plugins

Plugin list
React plugin
SVGR plugin
Vue plugin
Preact plugin
Svelte plugin
Solid plugin
Babel plugin
Sass plugin
Less plugin
Stylus plugin

Development

Plugin development
Plugin API
Plugin hooks
📝 Edit this page on GitHub
Previous PageSvelte plugin
Next PageBabel plugin

#Solid plugin

Source

The Solid plugin provides support for Solid features. The plugin internally integrates babel-preset-solid.

TIP

The Solid plugin relies on Babel transpilation and requires an additional Babel Plugin. At the same time, adding the Babel plugin will cause additional compilation overhead.

#Quick start

#Install plugin

You can install the plugin using the following command:

npm
yarn
pnpm
bun
npm add @rsbuild/plugin-babel @rsbuild/plugin-solid -D

#Register plugin

You can register the plugin in the rsbuild.config.ts file:

rsbuild.config.ts
import { pluginBabel } from '@rsbuild/plugin-babel';
import { pluginSolid } from '@rsbuild/plugin-solid';

export default {
  plugins: [
    pluginBabel({
      include: /\.(?:jsx|tsx)$/,
    }),
    pluginSolid(),
  ],
};

After registering the plugin, you can directly develop Solid.

TIP

Since the Solid JSX relies on Babel for compilation, you need to additionally add the Babel plugin.

Babel compilation will introduce extra overhead, in the example above, we use include to match .jsx and .tsx files, thereby reducing the performance cost brought by Babel.

#Options

To customize the compilation behavior of Solid, use the following options.

#solidPresetOptions

Options passed to babel-preset-solid, please refer to the babel-preset-solid documentation for detailed usage.

  • Type: SolidPresetOptions
  • Default: {}
  • Example:
pluginSolid({
  solidPresetOptions: {
    generate: 'ssr',
    hydratable: true,
  },
});