diff --git a/packages/core/src/cli/commands.ts b/packages/core/src/cli/commands.ts index cdf77f6ee3..54e24e7444 100644 --- a/packages/core/src/cli/commands.ts +++ b/packages/core/src/cli/commands.ts @@ -3,7 +3,7 @@ import { existsSync } from 'node:fs'; import { color, isDev, logger } from '@rsbuild/shared'; import { program, type Command } from '@rsbuild/shared/commander'; import { loadEnv } from '../loadEnv'; -import { loadConfig, watchFiles } from './config'; +import { loadConfig, watchFiles } from '../config'; import type { RsbuildMode } from '..'; import { onBeforeRestartServer } from '../server/restart'; diff --git a/packages/core/src/cli/config.ts b/packages/core/src/config.ts similarity index 98% rename from packages/core/src/cli/config.ts rename to packages/core/src/config.ts index 8e9ceea520..ec5209e8a6 100644 --- a/packages/core/src/cli/config.ts +++ b/packages/core/src/config.ts @@ -8,7 +8,7 @@ import { getNodeEnv, type RsbuildConfig, } from '@rsbuild/shared'; -import { restartDevServer } from '../server/restart'; +import { restartDevServer } from './server/restart'; export type ConfigParams = { env: string; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 8cc6b72789..9a403effb9 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -6,7 +6,7 @@ // Core Methods export { loadEnv } from './loadEnv'; export { createRsbuild } from './createRsbuild'; -export { loadConfig, defineConfig } from './cli/config'; +export { loadConfig, defineConfig } from './config'; export const version = RSBUILD_VERSION; diff --git a/packages/document/docs/en/config/plugins.mdx b/packages/document/docs/en/config/plugins.mdx index 34ffab485c..0be4a902f1 100644 --- a/packages/document/docs/en/config/plugins.mdx +++ b/packages/document/docs/en/config/plugins.mdx @@ -1,10 +1,21 @@ # plugins -Used to register Rsbuild plugins. +Used to register Rsbuild plugins. Please check the [Plugin List](/plugins/list/index) to discover available plugins. - **Type:** `RsbuildPlugin[]` - **Default:** `undefined` -- **Example:** Registering the Stylus plugin. + +## Example + +For example, register the Stylus plugin in Rsbuild. + +- Installing the plugin: + +import { PackageManagerTabs } from '@theme'; + + + +- Registering the plugin: ```ts title="rsbuild.config.ts" import { defineConfig } from '@rsbuild/core'; diff --git a/packages/document/docs/en/guide/basic/cli.mdx b/packages/document/docs/en/guide/basic/cli.mdx index f8ecef1568..9d2f1afa15 100644 --- a/packages/document/docs/en/guide/basic/cli.mdx +++ b/packages/document/docs/en/guide/basic/cli.mdx @@ -95,7 +95,7 @@ Do not use this as a production server as it's not designed for it. Usage: rsbuild preview [options] Options: - --open [url] open the page in browser on startup + -o, --open [url] open the page in browser on startup --port specify a port number for Rsbuild Server to listen --host specify the host that the Rsbuild Server listens to -c --config specify the configuration file, can be a relative or absolute path diff --git a/packages/document/docs/en/plugins/list/index.md b/packages/document/docs/en/plugins/list/index.md index bc764e1107..dd4c867bb7 100644 --- a/packages/document/docs/en/plugins/list/index.md +++ b/packages/document/docs/en/plugins/list/index.md @@ -72,3 +72,9 @@ The following are common framework-agnostic plugins: :::tip You can find the source code of all official plugins in the [web-infra-dev/rsbuild](https://github.com/web-infra-dev/rsbuild) repository. ::: + +## Community Plugins + +You can check out the Rsbuild plugins provided by the community at [awesome-rspack - Rsbuild Plugins](https://github.com/web-infra-dev/awesome-rspack?tab=readme-ov-file#rsbuild-plugins). + +You can also discover more Rsbuild plugins on npm by searching for the keyword [rsbuild-plugin](https://www.npmjs.com/search?q=rsbuild-plugin&ranking=popularity). diff --git a/packages/document/docs/zh/config/plugins.mdx b/packages/document/docs/zh/config/plugins.mdx index 67ecee9699..334bd19118 100644 --- a/packages/document/docs/zh/config/plugins.mdx +++ b/packages/document/docs/zh/config/plugins.mdx @@ -1,10 +1,21 @@ # plugins -用于注册 Rsbuild 插件。 +用于注册 Rsbuild 插件,请查看[插件列表](/plugins/list/index) 来发现可用的插件。 - **类型:** `RsbuildPlugin[]` - **默认值:** `undefined` -- **示例:** 注册 Stylus 插件。 + +## 示例 + +比如注册 Rsbuild 的 Stylus 插件。 + +- 安装插件: + +import { PackageManagerTabs } from '@theme'; + + + +- 注册插件: ```ts title="rsbuild.config.ts" import { defineConfig } from '@rsbuild/core'; diff --git a/packages/document/docs/zh/guide/basic/cli.mdx b/packages/document/docs/zh/guide/basic/cli.mdx index 525d4ff431..918f3d97d6 100644 --- a/packages/document/docs/zh/guide/basic/cli.mdx +++ b/packages/document/docs/zh/guide/basic/cli.mdx @@ -95,7 +95,7 @@ Options: Usage: rsbuild preview [options] Options: - --open [url] 启动时是否在浏览器中打开页面 + -o, --open [url] 启动时是否在浏览器中打开页面 --port 设置 Rsbuild Server 监听的端口号 --host 指定 Rsbuild Server 启动时监听的 host -c --config 指定配置文件路径,可以为相对路径或绝对路径 diff --git a/packages/document/docs/zh/plugins/list/index.md b/packages/document/docs/zh/plugins/list/index.md index 12f1e7c971..4b32547619 100644 --- a/packages/document/docs/zh/plugins/list/index.md +++ b/packages/document/docs/zh/plugins/list/index.md @@ -72,3 +72,9 @@ :::tip 你可以在 [web-infra-dev/rsbuild](https://github.com/web-infra-dev/rsbuild) 仓库中找到所有官方插件的源代码。 ::: + +## 社区插件 + +你可以在 [awesome-rspack - Rsbuild Plugins](https://github.com/web-infra-dev/awesome-rspack?tab=readme-ov-file#rsbuild-plugins) 中查看社区提供的 Rsbuild 插件。 + +也可以在 npm 上搜索 [rsbuild-plugin](https://www.npmjs.com/search?q=rsbuild-plugin&ranking=popularity) 关键词来发现更多 Rsbuild 插件。