Skip to content

Commit

Permalink
docs: improve configuration structure (#1669)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Feb 27, 2024
1 parent 9db30b1 commit 6552cb2
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 8 deletions.
12 changes: 8 additions & 4 deletions packages/document/docs/en/guide/basic/configure-rsbuild.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,30 @@ The configuration structure of Rsbuild looks like this:

```ts title="rsbuild.config.ts"
export default {
plugins: [
// configure Rsbuild plugins
],
dev: {
// options for local development
},
html: {
// options for HTML
// options for HTML generation
},
tools: {
// options for the low-level tools
},
output: {
// options for build outputs.
// options for build outputs
},
source: {
// options for source code parsing and compilation
},
server: {
// options for the Rsbuild Server, which will take effect during local development and preview
// options for the Rsbuild Server,
// will take effect during local development and preview
},
security: {
// options for security
// options for Web security
},
performance: {
// options for build performance and runtime performance
Expand Down
10 changes: 7 additions & 3 deletions packages/document/docs/zh/guide/basic/configure-rsbuild.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ Rsbuild 的配置结构如下所示:

```ts title="rsbuild.config.ts"
export default {
plugins: [
// 配置 Rsbuild 插件
],
dev: {
// 与本地开发有关的选项
},
html: {
// 与 HTML 有关的选项
// 与 HTML 生成有关的选项
},
tools: {
// 与底层工具有关的选项
Expand All @@ -26,10 +29,11 @@ export default {
// 与源代码解析、编译方式相关的选项
},
server: {
// 与 Rsbuild 服务器有关的选项,在本地开发和预览时都会生效
// 与 Rsbuild 服务器有关的选项
// 在本地开发和预览时都会生效
},
security: {
// 与安全有关的选项
// 与 Web 安全有关的选项
},
performance: {
// 与构建性能、运行时性能有关的选项
Expand Down
39 changes: 38 additions & 1 deletion packages/shared/src/types/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type NormalizedModuleFederationConfig = ModuleFederationConfig;

export type RsbuildConfigMeta = {
/**
* Path to the rsbuild config file
* Path to the rsbuild config file.
*/
configFilePath: string;
};
Expand All @@ -31,17 +31,54 @@ export type RsbuildConfigMeta = {
* Can be used with both Rspack and Webpack.
* */
export interface RsbuildConfig {
/**
* Options for local development.
*/
dev?: DevConfig;
/**
* Options for HTML generation.
*/
html?: HtmlConfig;
/**
* Options for the low-level tools.
*/
tools?: ToolsConfig;
/**
* Options for source code parsing and compilation.
*/
source?: SourceConfig;
/**
* Options for the Rsbuild Server,
* will take effect during local development and preview.
*/
server?: ServerConfig;
/**
* Options for build outputs.
*/
output?: OutputConfig;
/**
* Configure Rsbuild plugins.
*/
plugins?: RsbuildPlugins;
/**
* Options for Web security.
*/
security?: SecurityConfig;
/**
* Options for build performance and runtime performance.
*/
performance?: PerformanceConfig;
/**
* Options for module federation.
*/
moduleFederation?: ModuleFederationConfig;
/**
* Used to switch the bundler type.
*/
provider?: RsbuildProvider<'rspack'> | RsbuildProvider<'webpack'>;
/**
* @private
*/
_privateMeta?: RsbuildConfigMeta;
}

Expand Down

0 comments on commit 6552cb2

Please sign in to comment.