You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/guide/basic/configure-rslib.mdx
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,11 @@ The configuration structure of Rslib looks like this:
12
12
exportdefault {
13
13
// Array of library configurations.
14
14
// Each object represents a set of independent configurations for each output format.
15
-
//Different Rslib and Rsbuild configurations can be specified in each object.
15
+
//Distinct configurations can be specified in each object, which is a superset of Rsbuild configurations.
16
16
lib: [
17
17
// The first set of configurations
18
18
{
19
-
// Independent Rslib configuration of ESM format
19
+
// Independent lib configuration of ESM format
20
20
format:'esm', // options for the output format of JavaScript files
21
21
bundle:true, // options for the build type
22
22
autoExtension:true, // options for the extensions of JavaScript files
@@ -59,7 +59,7 @@ export default {
59
59
{
60
60
// The second set of configurations of CJS format
61
61
format:'cjs',
62
-
// ... other independent Rslib / Rsbuild configurations
62
+
// ... other independent lib configurations and Rsbuild configurations
63
63
},
64
64
// ... Extra sets of configurations (if needed)
65
65
],
@@ -82,10 +82,10 @@ export default {
82
82
83
83
The configuration file exports a default object that includes a `lib` array and shared Rsbuild configuration options. You can find detailed descriptions of all configs on the [Configure Overview](/config/) page.
84
84
85
-
-**Lib Configuration (required)**: The `lib` array contains multiple objects, each representing a set of independent configurations tailored for different output formats, such as ESM and CJS. Each object within the `lib` array can specify distinct configurations for both Rslib and Rsbuild.
86
-
-**Independent Rslib Configuration (required)**: The configuration options provided by Rslib. Rslib will transform these options into complex Rsbuild configuration of each object.
87
-
-**Independent Rsbuild Configuration (optional)**: The configuration options provided by Rsbuild which can override the shared Rsbuild configuration outside.
88
-
-**Shared Rsbuild Configuration (optional)**: Outside the `lib` array, there are shared Rsbuild configuration options that will be deep merged with independent Rsbuild configuration of each `lib` configuration object.
85
+
-**[Lib Configuration](/config/lib) (at least one object is required)**: The `lib` array contains multiple objects, each representing a set of independent configurations tailored for different output formats, such as ESM and CJS. Each object within the `lib` array can specify distinct configurations, which is a superset of Rsbuild configurations.
86
+
-**Independent [lib Configuration](/config/lib) (only [format](/config/lib/format) is required)**: The configuration options extended by Rslib. Rslib will transform these options into adapted Rsbuild configuration of each object.
87
+
-**Independent [Rsbuild Configuration](/config/rsbuild) (optional)**: The configuration options provided by Rsbuild which can override the shared Rsbuild configuration outside.
88
+
-**Shared [Rsbuild Configuration](/config/rsbuild) (optional)**: Outside the `lib` array, there are shared Rsbuild configuration options that will be deep merged with independent Rsbuild configuration of each `lib` configuration object.
89
89
90
90
Rslib generates corresponding Rsbuild [environments](https://rsbuild.dev/guide/advanced/environments) configurations based on the multiple build configurations of different output formats. See [Configuration Debug](#configuration-debug) for more details.
91
91
@@ -196,8 +196,10 @@ DEBUG=rsbuild pnpm build
196
196
197
197
In debug mode, Rslib will write the Rsbuild / Rspack config to the dist directory, which is convenient for developers to view and debug.
198
198
199
+
Below is an example of a configuration for Rslib that builds both CJS and ESM output.
200
+
199
201
```
200
-
success Inspect config succeed, open following files to view the content:
202
+
Inspect config succeed, open following files to view the content:
0 commit comments