Skip to content

Commit 87ad101

Browse files
committed
chore: update
1 parent b238144 commit 87ad101

File tree

5 files changed

+61
-61
lines changed

5 files changed

+61
-61
lines changed

website/docs/en/guide/advanced/json-files.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,19 +243,19 @@ If you want JSON / YAML / TOML files to be output to the distribution directory
243243

244244
For example, the following configuration will output all JSON files in the `src` directory as-is:
245245

246-
```ts title="rslib.config.ts" {7,11-12}
246+
```ts title="rslib.config.ts"
247247
export default defineConfig({
248248
lib: [
249249
{
250250
bundle: false,
251251
source: {
252252
entry: {
253-
index: ['./src/**', '!./src/**/*.json'],
253+
index: ['./src/**', '!./src/**/*.json'], // [!code highlight]
254254
},
255255
},
256256
output: {
257-
copy: [{ from: './**/*.json', context: './src' }],
258-
externals: [/.*\.json$/],
257+
copy: [{ from: './**/*.json', context: './src' }], // [!code highlight]
258+
externals: [/.*\.json$/], // [!code highlight]
259259
},
260260
},
261261
],

website/docs/en/guide/advanced/module-federation.mdx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { PackageManagerTabs } from '@theme';
3030

3131
Then register the plugin in the `rslib.config.ts` file:
3232

33-
```ts title='rslib.config.ts' {8-43}
33+
```ts title='rslib.config.ts'
3434
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin';
3535
import { pluginReact } from '@rsbuild/plugin-react';
3636
import { defineConfig } from '@rslib/core';
@@ -118,31 +118,31 @@ with Hot Module Replacement (HMR).
118118
Set up the host app to consume the Rslib Module Federation library. Check out the [@module-federation/rsbuild-plugin
119119
](https://www.npmjs.com/package/@module-federation/rsbuild-plugin) for more information.
120120

121-
```ts title="rsbuild.config.ts" {8-24}
121+
```ts title="rsbuild.config.ts"
122122
import { pluginModuleFederation } from '@module-federation/rsbuild-plugin';
123123
import { defineConfig } from '@rsbuild/core';
124124
import { pluginReact } from '@rsbuild/plugin-react';
125125

126126
export default defineConfig({
127127
plugins: [
128128
pluginReact(),
129-
pluginModuleFederation({
130-
name: 'rsbuild_host',
131-
remotes: {
132-
rslib: 'rslib@http://localhost:3001/mf/mf-manifest.json',
133-
},
134-
shared: {
135-
react: {
136-
singleton: true,
137-
},
138-
'react-dom': {
139-
singleton: true,
140-
},
141-
},
142-
// Enable this when the output of Rslib is build under 'production' mode, while the host app is 'development'.
143-
// Reference: https://lib.rsbuild.dev/guide/advanced/module-federation#faqs
144-
shareStrategy: 'loaded-first',
145-
}),
129+
pluginModuleFederation({ // [!code highlight]
130+
name: 'rsbuild_host', // [!code highlight]
131+
remotes: { // [!code highlight]
132+
rslib: 'rslib@http://localhost:3001/mf/mf-manifest.json', // [!code highlight]
133+
}, // [!code highlight]
134+
shared: { // [!code highlight]
135+
react: { // [!code highlight]
136+
singleton: true, // [!code highlight]
137+
}, // [!code highlight]
138+
'react-dom': { // [!code highlight]
139+
singleton: true, // [!code highlight]
140+
}, // [!code highlight]
141+
}, // [!code highlight]
142+
// Enable this when the output of Rslib is build under 'production' mode, while the host app is 'development'. // [!code highlight]
143+
// Reference: https://lib.rsbuild.dev/guide/advanced/module-federation#faqs // [!code highlight]
144+
shareStrategy: 'loaded-first', // [!code highlight]
145+
}), // [!code highlight]
146146
],
147147
});
148148
```
@@ -182,7 +182,7 @@ First, set up Storybook with the Rslib project. You can refer to the [Storybook
182182

183183
2. Then set up the Storybook configuration file `.storybook/main.ts`, specify the stories and addons, and set the framework with corresponding framework integration.
184184

185-
```ts title=".storybook/main.ts" {18-38}
185+
```ts title=".storybook/main.ts"
186186
import { dirname, join } from 'node:path';
187187
import type { StorybookConfig } from 'storybook-react-rsbuild';
188188

@@ -200,7 +200,7 @@ First, set up Storybook with the Rslib project. You can refer to the [Storybook
200200
options: {},
201201
},
202202
addons: [
203-
{
203+
{ // [!code highlight:20]
204204
name: getAbsolutePath('storybook-addon-rslib'),
205205
options: {
206206
rslib: {
@@ -231,10 +231,10 @@ First, set up Storybook with the Rslib project. You can refer to the [Storybook
231231

232232
Import components from remote module.
233233

234-
```ts title="stories/index.stories.tsx" {2-3}
234+
```ts title="stories/index.stories.tsx"
235235
import React from 'react';
236-
// Load your remote module here, Storybook will act as the host app.
237-
import { Counter } from 'rslib-module';
236+
// Load your remote module here, Storybook will act as the host app. // [!code highlight]
237+
import { Counter } from 'rslib-module'; // [!code highlight]
238238

239239
const Component = () => <Counter />;
240240

website/docs/en/guide/advanced/output-compatibility.mdx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ And install [core-js-pure](https://www.npmjs.com/package/core-js-pure) as the ru
3535

3636
Configure the Babel plugin with polyfill options, set the [targets](https://babeljs.io/docs/options#targets) field to specify the target browser version.
3737

38-
```ts title="rslib.config.ts" {1,11-24}
39-
import { pluginBabel } from '@rsbuild/plugin-babel';
38+
```ts title="rslib.config.ts"
39+
import { pluginBabel } from '@rsbuild/plugin-babel'; // [!code highlight]
4040
import { defineConfig } from '@rslib/core';
4141

4242
export default defineConfig({
@@ -46,20 +46,20 @@ export default defineConfig({
4646
},
4747
],
4848
plugins: [
49-
pluginBabel({
50-
babelLoaderOptions: {
51-
plugins: [
52-
[
53-
require('babel-plugin-polyfill-corejs3'),
54-
{
55-
method: 'usage-pure',
56-
targets: { ie: '10' },
57-
version: '3.29',
58-
},
59-
],
60-
],
61-
},
62-
}),
49+
pluginBabel({ // [!code highlight]
50+
babelLoaderOptions: { // [!code highlight]
51+
plugins: [ // [!code highlight]
52+
[ // [!code highlight]
53+
require('babel-plugin-polyfill-corejs3'), // [!code highlight]
54+
{ // [!code highlight]
55+
method: 'usage-pure', // [!code highlight]
56+
targets: { ie: '10' }, // [!code highlight]
57+
version: '3.29', // [!code highlight]
58+
}, // [!code highlight]
59+
], // [!code highlight]
60+
], // [!code highlight]
61+
}, // [!code highlight]
62+
}), // [!code highlight]
6363
],
6464
});
6565
```

website/docs/en/guide/basic/output-format.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,18 @@ The following Rslib config is an example to build a UMD library.
9797
- `output.externals.react: 'React'`: specify the external dependency `react` could be accessed by `window.React`.
9898
- `runtime: 'classic'`: use the classic runtime of React to support applications that using React version under 18.
9999

100-
```ts title="rslib.config.ts" {7-12,22}
100+
```ts title="rslib.config.ts"
101101
import { pluginReact } from '@rsbuild/plugin-react';
102102
import { defineConfig } from '@rslib/core';
103103

104104
export default defineConfig({
105105
lib: [
106106
{
107-
format: 'umd',
108-
umdName: 'RslibUmdExample',
107+
format: 'umd', // [!code highlight]
108+
umdName: 'RslibUmdExample', // [!code highlight]
109109
output: {
110110
externals: {
111-
react: 'React',
111+
react: 'React', // [!code highlight]
112112
},
113113
distPath: {
114114
root: './dist/umd',
@@ -122,7 +122,7 @@ export default defineConfig({
122122
plugins: [
123123
pluginReact({
124124
swcReactOptions: {
125-
runtime: 'classic',
125+
runtime: 'classic', // [!code highlight]
126126
},
127127
}),
128128
],

website/docs/en/guide/solution/react.mdx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ To compile React (JSX and TSX), you need to register the Rsbuild [React Plugin](
2727

2828
For example, register in `rslib.config.ts`:
2929

30-
```ts title="rslib.config.ts" {2,8-11}
30+
```ts title="rslib.config.ts"
3131
import { defineConfig } from '@rslib/core';
32-
import { pluginReact } from '@rsbuild/plugin-react';
32+
import { pluginReact } from '@rsbuild/plugin-react'; // [!code highlight]
3333

3434
export default defineConfig({
3535
lib: [
3636
// ...
3737
],
3838
output: {
39-
target: 'web',
39+
target: 'web', // [!code highlight]
4040
},
41-
plugins: [pluginReact(/** options here */)],
41+
plugins: [pluginReact(/** options here */)], // [!code highlight]
4242
});
4343
```
4444

@@ -53,7 +53,7 @@ By default, Rsbuild uses the new JSX transform, which is `runtime: 'automatic'`.
5353

5454
To change the JSX transform, you can pass the [swcReactOptions](https://rsbuild.dev/plugins/list/plugin-react#swcreactoptionsruntime) option to the React plugin. For example, to use the classic runtime:
5555

56-
```ts title="rslib.config.ts" {13-15}
56+
```ts title="rslib.config.ts"
5757
import { pluginReact } from '@rsbuild/plugin-react';
5858
import { defineConfig } from '@rslib/core';
5959

@@ -66,9 +66,9 @@ export default defineConfig({
6666
},
6767
plugins: [
6868
pluginReact({
69-
swcReactOptions: {
70-
runtime: 'classic',
71-
},
69+
swcReactOptions: { // [!code highlight]
70+
runtime: 'classic', // [!code highlight]
71+
}, // [!code highlight]
7272
}),
7373
],
7474
});
@@ -83,7 +83,7 @@ When `runtime` is set to `'automatic'`, you can specify the import path of the J
8383

8484
For example, when using [Emotion](https://emotion.sh/), you can set `importSource` to `'@emotion/react'`:
8585

86-
```ts title="rslib.config.ts" {13-15}
86+
```ts title="rslib.config.ts"
8787
import { pluginReact } from '@rsbuild/plugin-react';
8888
import { defineConfig } from '@rslib/core';
8989

@@ -96,9 +96,9 @@ export default defineConfig({
9696
},
9797
plugins: [
9898
pluginReact({
99-
swcReactOptions: {
100-
importSource: '@emotion/react',
101-
},
99+
swcReactOptions: { // [!code highlight]
100+
importSource: '@emotion/react', // [!code highlight]
101+
}, // [!code highlight]
102102
}),
103103
],
104104
});

0 commit comments

Comments
 (0)