Skip to content

Commit

Permalink
docs: correct style-loader example (#3518)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Sep 20, 2024
1 parent 44f5d8a commit 7ed329e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions website/docs/en/config/tools/style-loader.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ It is worth noting that Rsbuild does not enable `style-loader` by default. You c

## Object Type

When this value is an Object, it is merged with the default config via Object.assign. For example:
When `tools.styleLoader` is an object, it will be merged with the default configuration using `Object.assign`.

```js
export default {
tools: {
styleLoader: {
insert: 'head'
insert: 'head',
},
},
};
```

## Function Type

When the value is a Function, the default config is passed in as the first parameter. You can modify the config object directly, or return an object as the final config. For example:
When `tools.styleLoader` is a function, the default options will be passed in as the first parameter. You can directly modify this object or return a new object as the final options to be used. For example:

```js
export default {
tools: {
styleLoader: (config) => {
config.loaderOptions.insert = 'head';
config.insert = 'head';
return config;
},
},
Expand Down
4 changes: 2 additions & 2 deletions website/docs/zh/config/tools/style-loader.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Object 类型

当此值为 Object 类型时,与默认配置通过 Object.assign 合并。比如:
`tools.styleLoader` 是一个 object 时,它会与默认配置通过 `Object.assign` 合并。

```js
export default {
Expand All @@ -23,7 +23,7 @@ export default {

## Function 类型

当此值为 Function 类型时,默认配置作为第一个参数传入,你可以直接修改配置对象,也可以返回一个对象作为最终配置。比如:
`tools.styleLoader` 是一个 function 时,默认选项会作为第一个参数传入,你可以直接修改这个对象,也可以返回一个新的对象作为最终使用的选项。比如:

```js
export default {
Expand Down

0 comments on commit 7ed329e

Please sign in to comment.