close

Solid

本文介绍如何基于 Rsbuild 构建 Solid 应用。

创建 Solid 应用

使用 create-rsbuild 创建基于 Rsbuild 的 Solid 应用:

npm
yarn
pnpm
bun
npm create rsbuild@latest

然后在 Select framework 时选择 Solid 即可。

在已有项目中使用 Solid

要编译 Solid 组件,需注册 Rsbuild 的 Solid 插件,插件会自动添加 Solid 构建所需的配置。

例如,在 Rsbuild 配置中注册:

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

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