@modern-js/main-doc 2.67.4 → 2.67.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/en/apis/app/hooks/server/server.mdx +10 -0
- package/docs/en/apis/app/hooks/src/routes.mdx +3 -3
- package/docs/en/apis/app/runtime/bff/use-hono-context.mdx +30 -0
- package/docs/en/components/enable-bff.mdx +1 -27
- package/docs/en/components/rsbuild-config-tooltip.mdx +2 -2
- package/docs/en/components/tech-stack-node-framework.mdx +1 -1
- package/docs/en/configure/app/dev/asset-prefix.mdx +2 -3
- package/docs/en/configure/app/dev/client.mdx +2 -3
- package/docs/en/configure/app/dev/hmr.mdx +2 -3
- package/docs/en/configure/app/dev/live-reload.mdx +2 -3
- package/docs/en/configure/app/dev/progress-bar.mdx +2 -3
- package/docs/en/configure/app/dev/setup-middlewares.mdx +2 -3
- package/docs/en/configure/app/dev/watch-files.mdx +2 -3
- package/docs/en/configure/app/dev/write-to-disk.mdx +2 -3
- package/docs/en/configure/app/html/app-icon.mdx +2 -3
- package/docs/en/configure/app/html/crossorigin.mdx +2 -3
- package/docs/en/configure/app/html/favicon.mdx +2 -3
- package/docs/en/configure/app/html/inject.mdx +2 -3
- package/docs/en/configure/app/html/meta.mdx +2 -3
- package/docs/en/configure/app/html/mount-id.mdx +2 -3
- package/docs/en/configure/app/html/output-structure.mdx +2 -3
- package/docs/en/configure/app/html/script-loading.mdx +2 -3
- package/docs/en/configure/app/html/tags.mdx +2 -3
- package/docs/en/configure/app/html/template-parameters.mdx +2 -3
- package/docs/en/configure/app/html/template.mdx +2 -3
- package/docs/en/configure/app/html/title.mdx +2 -3
- package/docs/en/configure/app/output/asset-prefix.mdx +2 -3
- package/docs/en/configure/app/output/charset.mdx +2 -3
- package/docs/en/configure/app/output/copy.mdx +2 -3
- package/docs/en/configure/app/output/css-modules.mdx +2 -3
- package/docs/en/configure/app/output/data-uri-limit.mdx +2 -3
- package/docs/en/configure/app/output/dist-path.mdx +2 -4
- package/docs/en/configure/app/output/externals.mdx +2 -3
- package/docs/en/configure/app/output/filename-hash.mdx +2 -3
- package/docs/en/configure/app/output/filename.mdx +2 -3
- package/docs/en/configure/app/output/inject-styles.mdx +2 -3
- package/docs/en/configure/app/output/inline-scripts.mdx +2 -3
- package/docs/en/configure/app/output/inline-styles.mdx +2 -3
- package/docs/en/configure/app/output/legal-comments.mdx +2 -3
- package/docs/en/configure/app/output/minify.mdx +2 -3
- package/docs/en/configure/app/output/override-browserslist.mdx +2 -3
- package/docs/en/configure/app/output/polyfill.mdx +2 -3
- package/docs/en/configure/app/output/source-map.mdx +2 -3
- package/docs/en/configure/app/performance/build-cache.mdx +2 -3
- package/docs/en/configure/app/performance/bundle-analyze.mdx +2 -3
- package/docs/en/configure/app/performance/chunk-split.mdx +2 -3
- package/docs/en/configure/app/performance/dns-prefetch.mdx +2 -3
- package/docs/en/configure/app/performance/preconnect.mdx +2 -3
- package/docs/en/configure/app/performance/prefetch.mdx +2 -3
- package/docs/en/configure/app/performance/preload.mdx +2 -3
- package/docs/en/configure/app/performance/print-file-size.mdx +2 -3
- package/docs/en/configure/app/performance/profile.mdx +2 -3
- package/docs/en/configure/app/performance/remove-console.mdx +2 -3
- package/docs/en/configure/app/performance/remove-moment-locale.mdx +2 -3
- package/docs/en/configure/app/plugins.mdx +13 -33
- package/docs/en/configure/app/runtime/master-app.mdx +1 -5
- package/docs/en/configure/app/runtime/plugins.mdx +58 -0
- package/docs/en/configure/app/security/nonce.mdx +2 -3
- package/docs/en/configure/app/security/sri.mdx +0 -1
- package/docs/en/configure/app/server/port.mdx +2 -3
- package/docs/en/configure/app/source/alias-strategy.mdx +2 -3
- package/docs/en/configure/app/source/alias.mdx +2 -3
- package/docs/en/configure/app/source/decorators.mdx +2 -3
- package/docs/en/configure/app/source/define.mdx +2 -3
- package/docs/en/configure/app/source/exclude.mdx +2 -3
- package/docs/en/configure/app/source/include.mdx +2 -3
- package/docs/en/configure/app/source/pre-entry.mdx +2 -3
- package/docs/en/configure/app/source/transform-import.mdx +2 -3
- package/docs/en/configure/app/tools/css-extract.mdx +2 -3
- package/docs/en/configure/app/tools/css-loader.mdx +2 -2
- package/docs/en/configure/app/tools/html-plugin.mdx +7 -3
- package/docs/en/configure/app/tools/lightningcss-loader.mdx +2 -3
- package/docs/en/configure/app/tools/postcss.mdx +2 -3
- package/docs/en/configure/app/tools/rspack.mdx +2 -3
- package/docs/en/configure/app/tools/style-loader.mdx +2 -3
- package/docs/en/configure/app/tools/swc.mdx +1 -1
- package/docs/en/configure/app/usage.mdx +1 -1
- package/docs/en/guides/advanced-features/bff/extend-server.mdx +33 -82
- package/docs/en/guides/advanced-features/bff/frameworks.mdx +12 -68
- package/docs/en/guides/advanced-features/bff.mdx +1 -1
- package/docs/en/guides/advanced-features/compatibility.mdx +1 -1
- package/docs/en/guides/advanced-features/page-performance/_meta.json +1 -1
- package/docs/en/guides/advanced-features/page-performance/inline-assets.mdx +2 -0
- package/docs/en/guides/advanced-features/page-performance/optimize-bundle.mdx +1 -1
- package/docs/en/guides/advanced-features/page-performance/react-compiler.mdx +44 -0
- package/docs/en/guides/advanced-features/web-server.mdx +378 -14
- package/docs/en/guides/basic-features/data/data-fetch.mdx +2 -1
- package/docs/en/guides/basic-features/deploy.mdx +3 -3
- package/docs/en/guides/basic-features/html.mdx +3 -3
- package/docs/en/guides/basic-features/output-files.mdx +0 -28
- package/docs/en/guides/basic-features/render/ssr.mdx +2 -2
- package/docs/en/guides/concept/entries.mdx +1 -1
- package/docs/en/plugin/cli-plugins/api.mdx +6 -0
- package/docs/en/plugin/runtime-plugins/api.mdx +37 -12
- package/docs/en/tutorials/first-app/c04-routes.mdx +4 -2
- package/docs/en/tutorials/first-app/c05-loader.mdx +5 -2
- package/docs/zh/apis/app/hooks/server/server.mdx +10 -0
- package/docs/zh/apis/app/hooks/src/routes.mdx +3 -3
- package/docs/zh/apis/app/runtime/bff/use-hono-context.mdx +31 -0
- package/docs/zh/components/enable-bff.mdx +2 -27
- package/docs/zh/components/rsbuild-config-tooltip.mdx +2 -2
- package/docs/zh/components/tech-stack-node-framework.mdx +1 -1
- package/docs/zh/configure/app/dev/asset-prefix.mdx +2 -3
- package/docs/zh/configure/app/dev/client.mdx +2 -3
- package/docs/zh/configure/app/dev/hmr.mdx +2 -3
- package/docs/zh/configure/app/dev/live-reload.mdx +2 -3
- package/docs/zh/configure/app/dev/progress-bar.mdx +2 -3
- package/docs/zh/configure/app/dev/setup-middlewares.mdx +2 -3
- package/docs/zh/configure/app/dev/watch-files.mdx +2 -3
- package/docs/zh/configure/app/dev/write-to-disk.mdx +2 -3
- package/docs/zh/configure/app/html/app-icon.mdx +2 -3
- package/docs/zh/configure/app/html/crossorigin.mdx +2 -3
- package/docs/zh/configure/app/html/favicon.mdx +2 -3
- package/docs/zh/configure/app/html/inject.mdx +2 -3
- package/docs/zh/configure/app/html/meta.mdx +2 -3
- package/docs/zh/configure/app/html/mount-id.mdx +2 -3
- package/docs/zh/configure/app/html/output-structure.mdx +2 -3
- package/docs/zh/configure/app/html/script-loading.mdx +2 -3
- package/docs/zh/configure/app/html/tags.mdx +2 -3
- package/docs/zh/configure/app/html/template-parameters.mdx +2 -3
- package/docs/zh/configure/app/html/template.mdx +2 -3
- package/docs/zh/configure/app/html/title.mdx +2 -3
- package/docs/zh/configure/app/output/asset-prefix.mdx +2 -3
- package/docs/zh/configure/app/output/charset.mdx +2 -3
- package/docs/zh/configure/app/output/copy.mdx +2 -3
- package/docs/zh/configure/app/output/css-modules.mdx +2 -3
- package/docs/zh/configure/app/output/data-uri-limit.mdx +2 -3
- package/docs/zh/configure/app/output/dist-path.mdx +2 -4
- package/docs/zh/configure/app/output/externals.mdx +2 -3
- package/docs/zh/configure/app/output/filename-hash.mdx +2 -3
- package/docs/zh/configure/app/output/filename.mdx +2 -3
- package/docs/zh/configure/app/output/inject-styles.mdx +2 -3
- package/docs/zh/configure/app/output/inline-scripts.mdx +2 -3
- package/docs/zh/configure/app/output/inline-styles.mdx +2 -3
- package/docs/zh/configure/app/output/legal-comments.mdx +2 -3
- package/docs/zh/configure/app/output/minify.mdx +2 -3
- package/docs/zh/configure/app/output/override-browserslist.mdx +2 -3
- package/docs/zh/configure/app/output/polyfill.mdx +2 -3
- package/docs/zh/configure/app/output/source-map.mdx +2 -3
- package/docs/zh/configure/app/performance/build-cache.mdx +2 -3
- package/docs/zh/configure/app/performance/bundle-analyze.mdx +2 -3
- package/docs/zh/configure/app/performance/chunk-split.mdx +2 -3
- package/docs/zh/configure/app/performance/dns-prefetch.mdx +2 -3
- package/docs/zh/configure/app/performance/preconnect.mdx +2 -3
- package/docs/zh/configure/app/performance/prefetch.mdx +2 -3
- package/docs/zh/configure/app/performance/preload.mdx +2 -3
- package/docs/zh/configure/app/performance/print-file-size.mdx +2 -3
- package/docs/zh/configure/app/performance/profile.mdx +2 -3
- package/docs/zh/configure/app/performance/remove-console.mdx +2 -3
- package/docs/zh/configure/app/performance/remove-moment-locale.mdx +2 -3
- package/docs/zh/configure/app/plugins.mdx +3 -24
- package/docs/zh/configure/app/runtime/master-app.mdx +1 -5
- package/docs/zh/configure/app/runtime/plugins.mdx +58 -0
- package/docs/zh/configure/app/security/nonce.mdx +2 -3
- package/docs/zh/configure/app/security/sri.mdx +0 -1
- package/docs/zh/configure/app/server/port.mdx +2 -3
- package/docs/zh/configure/app/source/alias-strategy.mdx +2 -3
- package/docs/zh/configure/app/source/alias.mdx +2 -3
- package/docs/zh/configure/app/source/decorators.mdx +2 -3
- package/docs/zh/configure/app/source/define.mdx +2 -3
- package/docs/zh/configure/app/source/exclude.mdx +2 -3
- package/docs/zh/configure/app/source/include.mdx +2 -3
- package/docs/zh/configure/app/source/pre-entry.mdx +2 -3
- package/docs/zh/configure/app/source/transform-import.mdx +2 -3
- package/docs/zh/configure/app/tools/css-extract.mdx +2 -3
- package/docs/zh/configure/app/tools/css-loader.mdx +2 -3
- package/docs/zh/configure/app/tools/html-plugin.mdx +6 -3
- package/docs/zh/configure/app/tools/lightningcss-loader.mdx +2 -3
- package/docs/zh/configure/app/tools/postcss.mdx +2 -3
- package/docs/zh/configure/app/tools/rspack.mdx +2 -3
- package/docs/zh/configure/app/tools/style-loader.mdx +2 -3
- package/docs/zh/configure/app/tools/swc.mdx +1 -1
- package/docs/zh/configure/app/usage.mdx +1 -1
- package/docs/zh/guides/advanced-features/bff/extend-server.mdx +28 -76
- package/docs/zh/guides/advanced-features/bff/frameworks.mdx +6 -66
- package/docs/zh/guides/advanced-features/page-performance/_meta.json +1 -1
- package/docs/zh/guides/advanced-features/page-performance/react-compiler.mdx +44 -0
- package/docs/zh/guides/advanced-features/web-server.mdx +375 -18
- package/docs/zh/guides/basic-features/deploy.mdx +4 -3
- package/docs/zh/guides/basic-features/output-files.mdx +0 -28
- package/docs/zh/plugin/cli-plugins/api.mdx +6 -0
- package/docs/zh/plugin/runtime-plugins/api.mdx +37 -12
- package/docs/zh/tutorials/first-app/c04-routes.mdx +4 -2
- package/docs/zh/tutorials/first-app/c05-loader.mdx +4 -1
- package/package.json +7 -4
- package/rspress.config.ts +16 -1
- package/src/components/RsbuildLink/index.tsx +2 -2
- package/src/i18n/index.ts +1 -1
- package/src/index.ts +1 -5
- package/src/pages/index.tsx +3 -3
- package/docs/en/apis/app/hooks/api/middleware.mdx +0 -11
- package/docs/en/apis/app/runtime/bff/hook.mdx +0 -44
- package/docs/en/apis/app/runtime/bff/use-context.mdx +0 -38
- package/docs/en/configure/app/bff/enable-handle-web.mdx +0 -24
- package/docs/zh/apis/app/hooks/api/middleware.mdx +0 -11
- package/docs/zh/apis/app/runtime/bff/hook.mdx +0 -44
- package/docs/zh/apis/app/runtime/bff/use-context.mdx +0 -38
- package/docs/zh/configure/app/bff/enable-handle-web.mdx +0 -24
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: legalComments
|
3
|
-
configName: output.legalComments
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.legalComments
|
@@ -18,6 +17,6 @@ This behavior can be configured by using one of the following options:
|
|
18
17
|
- `inline`: Preserve all legal comments in original position.
|
19
18
|
- `none`: Remove all legal comments.
|
20
19
|
|
21
|
-
import
|
20
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
22
21
|
|
23
|
-
<
|
22
|
+
<RsbuildConfig configName="output.legalComments" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: minify
|
3
|
-
configName: output.minify
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.minify
|
@@ -22,6 +21,6 @@ type Minify =
|
|
22
21
|
|
23
22
|
Configure whether to enable code minification in production mode, or to configure minimizer options.
|
24
23
|
|
25
|
-
import
|
24
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
26
25
|
|
27
|
-
<
|
26
|
+
<RsbuildConfig configName="output.minify" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: overrideBrowserslist
|
3
|
-
configName: output.overrideBrowserslist
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.overrideBrowserslist
|
@@ -20,6 +19,6 @@ Modern.js will give priority to using the configuration in the `.browserslistrc`
|
|
20
19
|
|
21
20
|
Specifies the range of target browsers that the project is compatible with. This value will be used by [SWC](https://github.com/swc-project/swc) and [autoprefixer](https://github.com/postcss/autoprefixer) to identify the JavaScript syntax that need to be transformed and the CSS browser prefixes that need to be added.
|
22
21
|
|
23
|
-
import
|
22
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
24
23
|
|
25
|
-
<
|
24
|
+
<RsbuildConfig configName="output.overrideBrowserslist" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: polyfill
|
3
|
-
configName: output.polyfill
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.polyfill
|
@@ -14,6 +13,6 @@ import OutputPolyfillExtend from '@site-docs-en/components/output-polyfill-exten
|
|
14
13
|
|
15
14
|
<OutputPolyfillExtend />
|
16
15
|
|
17
|
-
import
|
16
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
18
17
|
|
19
|
-
<
|
18
|
+
<RsbuildConfig configName="output.polyfill" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: sourceMap
|
3
|
-
configName: output.sourceMap
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.sourceMap
|
@@ -27,6 +26,6 @@ const defaultSourceMap = {
|
|
27
26
|
|
28
27
|
Used to set whether to generate source map files, and which format of source map to generate.
|
29
28
|
|
30
|
-
import
|
29
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
31
30
|
|
32
|
-
<
|
31
|
+
<RsbuildConfig configName="output.sourceMap" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: buildCache
|
3
|
-
configName: performance.buildCache
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.buildCache
|
@@ -41,6 +40,6 @@ export default {
|
|
41
40
|
|
42
41
|
It should be noted that, Rspack's persistent cache is [experimental](https://rspack.dev/config/experiments#experimentscache), which may change in future versions, and this feature needs to be turned on manually.
|
43
42
|
|
44
|
-
import
|
43
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
45
44
|
|
46
|
-
<
|
45
|
+
<RsbuildConfig configName="performance.buildCache" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: bundleAnalyze
|
3
|
-
configName: performance.bundleAnalyze
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.bundleAnalyze
|
@@ -20,6 +19,6 @@ const defaultConfig = {
|
|
20
19
|
};
|
21
20
|
```
|
22
21
|
|
23
|
-
import
|
22
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
24
23
|
|
25
|
-
<
|
24
|
+
<RsbuildConfig configName="performance.bundleAnalyze" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: chunkSplit
|
3
|
-
configName: performance.chunkSplit
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.chunkSplit
|
@@ -40,6 +39,6 @@ interface SplitCustom {
|
|
40
39
|
export type ChunkSplit = BaseChunkSplit | SplitBySize | SplitCustom;
|
41
40
|
```
|
42
41
|
|
43
|
-
import
|
42
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
44
43
|
|
45
|
-
<
|
44
|
+
<RsbuildConfig configName="performance.chunkSplit" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: dnsPrefetch
|
3
|
-
configName: performance.dnsPrefetch
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.dnsPrefetch
|
@@ -15,6 +14,6 @@ After this property is set, the domain name can be resolved before the resource
|
|
15
14
|
|
16
15
|
See [Using dns-prefetch](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch) for more details.
|
17
16
|
|
18
|
-
import
|
17
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
19
18
|
|
20
|
-
<
|
19
|
+
<RsbuildConfig configName="performance.dnsPrefetch" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: preconnect
|
3
|
-
configName: performance.preconnect
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.preconnect
|
@@ -16,6 +15,6 @@ interface PreconnectOption {
|
|
16
15
|
|
17
16
|
- **Default:** `undefined`
|
18
17
|
|
19
|
-
import
|
18
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
20
19
|
|
21
|
-
<
|
20
|
+
<RsbuildConfig configName="performance.preconnect" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: prefetch
|
3
|
-
configName: performance.prefetch
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.prefetch
|
@@ -21,6 +20,6 @@ interface PrefetchOption {
|
|
21
20
|
|
22
21
|
- **Default:** `undefined`
|
23
22
|
|
24
|
-
import
|
23
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
25
24
|
|
26
|
-
<
|
25
|
+
<RsbuildConfig configName="performance.prefetch" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: preload
|
3
|
-
configName: performance.preload
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.preload
|
@@ -23,6 +22,6 @@ interface PreloadOption {
|
|
23
22
|
|
24
23
|
Inject the [`<link rel="preload">`](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Attributes/rel/preload) tags for the static assets generated by Rsbuild.
|
25
24
|
|
26
|
-
import
|
25
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
27
26
|
|
28
|
-
<
|
27
|
+
<RsbuildConfig configName="performance.preload" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: printFileSize
|
3
|
-
configName: performance.printFileSize
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.printFileSize
|
@@ -40,6 +39,6 @@ info Production file sizes:
|
|
40
39
|
dist/static/css/main.03221f72.css 1.4 kB 741 B
|
41
40
|
```
|
42
41
|
|
43
|
-
import
|
42
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
44
43
|
|
45
|
-
<
|
44
|
+
<RsbuildConfig configName="performance.printFileSize" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: profile
|
3
|
-
configName: performance.profile
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.profile
|
@@ -10,6 +9,6 @@ configName: performance.profile
|
|
10
9
|
|
11
10
|
Whether capture timing information for each module, same as the [profile](https://webpack.js.org/configuration/other-options/#profile) config of Rspack.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="performance.profile" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: removeConsole
|
3
|
-
configName: performance.removeConsole
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.removeConsole
|
@@ -10,6 +9,6 @@ configName: performance.removeConsole
|
|
10
9
|
|
11
10
|
Whether to remove `console.[methodName]` in production build.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="performance.removeConsole" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: removeMomentLocale
|
3
|
-
configName: performance.removeMomentLocale
|
4
3
|
---
|
5
4
|
|
6
5
|
# performance.removeMomentLocale
|
@@ -10,6 +9,6 @@ configName: performance.removeMomentLocale
|
|
10
9
|
|
11
10
|
Whether to remove the locales of [moment.js](https://momentjs.com/).
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="performance.removeMomentLocale" />
|
@@ -1,47 +1,27 @@
|
|
1
|
-
---
|
2
|
-
sidebar_position: 9
|
3
|
-
---
|
4
|
-
|
5
1
|
# plugins
|
6
2
|
|
7
3
|
- **Type:** `CliPlugin[]`
|
8
4
|
- **Default:** `[]`
|
9
5
|
|
10
|
-
Used to configure custom Modern.js framework plugins.
|
11
|
-
|
12
|
-
Refer to [How to Develop Plugins](/plugin/plugin-system) for how to write custom plugins.
|
6
|
+
Used to configure custom Modern.js framework CLI plugins. For information on how to create custom CLI plugins, please refer to [How to Write CLI Plugins](/plugin/introduction.html#cli-plugins).
|
13
7
|
|
14
8
|
## Note
|
15
9
|
|
16
|
-
This option is
|
17
|
-
|
18
|
-
- Use [builderPlugins](/configure/app/builder-plugins) to configure Rsbuild plugins.
|
19
|
-
- Use [tools.bundlerChain](/configure/app/tools/bundler-chain) to configure Rspack or webpack plugins.
|
20
|
-
- Use [tools.babel](/configure/app/tools/babel) to configure Babel plugins.
|
21
|
-
|
22
|
-
## Plugin types
|
23
|
-
|
24
|
-
Modern.js has three types of plugins:
|
25
|
-
|
26
|
-
- `CLI plugins`, applicable to local development, compilation and construction stages, can extend various capabilities in the command line and compilation stages.
|
27
|
-
- `Server plugins`, applicable to the server.
|
28
|
-
- `Runtime plugins`, applicable to the front-end runtime.
|
29
|
-
|
30
|
-
Currently, Modern.js has opened up the ability to customize CLI plugins, and Server plugins and Runtime plugins will be opened up later.
|
31
|
-
|
32
|
-
## Plugin execution order
|
10
|
+
This option is **specifically for configuring framework CLI plugins**. If you need to configure other types of plugins, use the appropriate configuration method:
|
33
11
|
|
34
|
-
|
12
|
+
- Use [builderPlugins](/configure/app/builder-plugins) for Rsbuild plugins.
|
13
|
+
- Use [tools.bundlerChain](/configure/app/tools/bundler-chain) for Rspack or webpack plugins.
|
14
|
+
- Use [tools.babel](/configure/app/tools/babel) for Babel plugins.
|
15
|
+
- Use the [plugins field in runtime config](/configure/app/runtime/plugins) for framework Runtime plugins.
|
35
16
|
|
36
|
-
When the plugin sets options that control the order, such as `pre` and `post`, the execution order will be adjusted based on the declared fields. Refer to [Plugins Structure](/plugin/plugin-system) for more information.
|
37
17
|
|
38
|
-
##
|
18
|
+
## Examples
|
39
19
|
|
40
|
-
|
20
|
+
Below are examples of using CLI plugins:
|
41
21
|
|
42
|
-
###
|
22
|
+
### Using plugins from npm
|
43
23
|
|
44
|
-
To use plugins from npm registry,
|
24
|
+
To use plugins from the npm registry, first install the plugins and then import them in your configuration:
|
45
25
|
|
46
26
|
```ts title="modern.config.ts"
|
47
27
|
import { myPlugin } from 'my-plugin';
|
@@ -51,9 +31,9 @@ export default defineConfig({
|
|
51
31
|
});
|
52
32
|
```
|
53
33
|
|
54
|
-
###
|
34
|
+
### Using local plugins
|
55
35
|
|
56
|
-
To use local
|
36
|
+
To use plugins from your local repository, import them directly using a relative path:
|
57
37
|
|
58
38
|
```ts title="modern.config.ts"
|
59
39
|
import { myPlugin } from './config/plugin/myPlugin';
|
@@ -65,7 +45,7 @@ export default defineConfig({
|
|
65
45
|
|
66
46
|
### Plugin configuration
|
67
47
|
|
68
|
-
If
|
48
|
+
If a plugin provides custom configuration options, pass them as parameters to the plugin function:
|
69
49
|
|
70
50
|
```ts title="modern.config.ts"
|
71
51
|
import { myPlugin } from 'my-plugin';
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# plugins
|
2
|
+
|
3
|
+
- **Type:** `RuntimePlugin[]`
|
4
|
+
- **Default:** `[]`
|
5
|
+
|
6
|
+
Used to configure custom Modern.js Runtime plugins. For details on how to create custom Runtime plugins, please refer to [How to Write Runtime Plugins](/plugin/introduction#runtime-plugins).
|
7
|
+
|
8
|
+
:::info
|
9
|
+
|
10
|
+
Runtime plugins must be configured in the `plugins` array within the `src/modern.runtime.ts` file.
|
11
|
+
|
12
|
+
:::
|
13
|
+
|
14
|
+
## Examples
|
15
|
+
|
16
|
+
Here are examples demonstrating how to use Runtime plugins:
|
17
|
+
|
18
|
+
### Using plugins from npm packages
|
19
|
+
|
20
|
+
To use plugins published on npm, first install them via your package manager, then import them into your configuration.
|
21
|
+
|
22
|
+
```ts title="src/modern.runtime.ts"
|
23
|
+
import { defineRuntimeConfig } from '@modern-js/runtime';
|
24
|
+
import { myPlugin } from 'my-plugin';
|
25
|
+
|
26
|
+
export default defineRuntimeConfig({
|
27
|
+
plugins: [myPlugin()],
|
28
|
+
});
|
29
|
+
```
|
30
|
+
|
31
|
+
### Using local plugins
|
32
|
+
|
33
|
+
To use plugins from your local codebase, import them directly using relative paths.
|
34
|
+
|
35
|
+
```ts title="src/modern.runtime.ts"
|
36
|
+
import { defineRuntimeConfig } from '@modern-js/runtime';
|
37
|
+
import { myPlugin } from './config/plugin/myPlugin';
|
38
|
+
|
39
|
+
export default defineRuntimeConfig({
|
40
|
+
plugins: [myPlugin()],
|
41
|
+
});
|
42
|
+
```
|
43
|
+
|
44
|
+
### Plugin configuration
|
45
|
+
|
46
|
+
If a plugin supports custom configuration options, you can provide them as arguments to the plugin function.
|
47
|
+
|
48
|
+
```ts title="src/modern.runtime.ts"
|
49
|
+
import { defineRuntimeConfig } from '@modern-js/runtime';
|
50
|
+
import { myPlugin } from './config/plugin/myPlugin';
|
51
|
+
|
52
|
+
export default defineRuntimeConfig({
|
53
|
+
plugins: [myPlugin({
|
54
|
+
foo: 1,
|
55
|
+
bar: 2,
|
56
|
+
})],
|
57
|
+
});
|
58
|
+
```
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: nonce
|
3
|
-
configName: security.nonce
|
4
3
|
---
|
5
4
|
|
6
5
|
# security.nonce
|
@@ -15,6 +14,6 @@ type Nonce = string;
|
|
15
14
|
|
16
15
|
Adding a `nonce` attribute to the scripts resources introduced for HTML. This allows the browser to determine whether the script can be executed when it parses inline scripts with matching nonce values.
|
17
16
|
|
18
|
-
import
|
17
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
19
18
|
|
20
|
-
<
|
19
|
+
<RsbuildConfig configName="security.nonce" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: port
|
3
|
-
configName: server.port
|
4
3
|
---
|
5
4
|
|
6
5
|
# server.port
|
@@ -38,6 +37,6 @@ export default defineConfig({
|
|
38
37
|
});
|
39
38
|
```
|
40
39
|
|
41
|
-
import
|
40
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
42
41
|
|
43
|
-
<
|
42
|
+
<RsbuildConfig configName="server.port" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: aliasStrategy
|
3
|
-
configName: source.aliasStrategy
|
4
3
|
---
|
5
4
|
|
6
5
|
# source.aliasStrategy
|
@@ -10,6 +9,6 @@ configName: source.aliasStrategy
|
|
10
9
|
|
11
10
|
`source.aliasStrategy` is used to control the priority between the `paths` option in `tsconfig.json` and the `alias` option in the bundler.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="source.aliasStrategy" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: alias
|
3
|
-
configName: source.alias
|
4
3
|
---
|
5
4
|
|
6
5
|
# source.alias
|
@@ -19,6 +18,6 @@ Create aliases to import or require certain modules, same as the [resolve.alias]
|
|
19
18
|
For TypeScript projects, you only need to configure [compilerOptions.paths](https://www.typescriptlang.org/tsconfig#paths) in the `tsconfig.json` file. The Rsbuild will automatically recognize it, so there is no need to configure the `source.alias` option separately. For more details, please refer to [Path Aliases](https://modernjs.dev/en/guides/basic-features/alias.html).
|
20
19
|
:::
|
21
20
|
|
22
|
-
import
|
21
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
23
22
|
|
24
|
-
<
|
23
|
+
<RsbuildConfig configName="source.alias" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: decorators
|
3
|
-
configName: source.decorators
|
4
3
|
---
|
5
4
|
|
6
5
|
# source.decorators
|
@@ -23,6 +22,6 @@ const defaultDecorators = {
|
|
23
22
|
|
24
23
|
Used to configure the decorators syntax.
|
25
24
|
|
26
|
-
import
|
25
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
27
26
|
|
28
|
-
<
|
27
|
+
<RsbuildConfig configName="source.decorators" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: define
|
3
|
-
configName: source.define
|
4
3
|
---
|
5
4
|
|
6
5
|
# source.define
|
@@ -16,6 +15,6 @@ const defaultDefine = {
|
|
16
15
|
|
17
16
|
Replaces variables in your code with other values or expressions at compile time. This can be useful for allowing different behavior between development builds and production builds.
|
18
17
|
|
19
|
-
import
|
18
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
20
19
|
|
21
|
-
<
|
20
|
+
<RsbuildConfig configName="source.define" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: exclude
|
3
|
-
configName: source.exclude
|
4
3
|
---
|
5
4
|
|
6
5
|
# source.exclude
|
@@ -10,6 +9,6 @@ configName: source.exclude
|
|
10
9
|
|
11
10
|
Specifies JavaScript/TypeScript files that do not need to be compiled. The usage is consistent with [Rule.exclude](https://rspack.dev/config/module#ruleexclude) in Rspack, which supports passing in strings or regular expressions to match the module path.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="source.exclude" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: include
|
3
|
-
configName: source.include
|
4
3
|
---
|
5
4
|
|
6
5
|
# source.include
|
@@ -21,6 +20,6 @@ const defaultInclude = [
|
|
21
20
|
|
22
21
|
The `source.include` is used to specify additional JavaScript files that need to be compiled.
|
23
22
|
|
24
|
-
import
|
23
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
25
24
|
|
26
|
-
<
|
25
|
+
<RsbuildConfig configName="source.include" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: preEntry
|
3
|
-
configName: source.preEntry
|
4
3
|
---
|
5
4
|
|
6
5
|
# source.preEntry
|
@@ -10,6 +9,6 @@ configName: source.preEntry
|
|
10
9
|
|
11
10
|
Add a script before the entry file of each page. This script will be executed before the page code. It can be used to execute global logics, such as injecting polyfills, setting global styles, etc.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="source.preEntry" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: transformImport
|
3
|
-
configName: source.transformImport
|
4
3
|
---
|
5
4
|
|
6
5
|
# source.transformImport
|
@@ -59,9 +58,9 @@ const defaultArcoConfig = [
|
|
59
58
|
When you add configurations for `antd` or `@arco-design/web-react`, the priority will be higher than the default configurations mentioned above.
|
60
59
|
:::
|
61
60
|
|
62
|
-
import
|
61
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
63
62
|
|
64
|
-
<
|
63
|
+
<RsbuildConfig configName="source.transformImport" />
|
65
64
|
|
66
65
|
### Disable Default Config
|
67
66
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: cssExtract
|
3
|
-
configName: tools.cssExtract
|
4
3
|
---
|
5
4
|
|
6
5
|
# tools.cssExtract
|
@@ -33,6 +32,6 @@ const defaultOptions = {
|
|
33
32
|
|
34
33
|
The config of [CssExtractRspackPlugin](https://www.rspack.dev/plugins/rspack/css-extract-rspack-plugin) / [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin) can be modified through `tools.cssExtract`.
|
35
34
|
|
36
|
-
import
|
35
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
37
36
|
|
38
|
-
<
|
37
|
+
<RsbuildConfig configName="tools.cssExtract" />
|
@@ -16,6 +16,6 @@ const defaultOptions = {
|
|
16
16
|
|
17
17
|
The config of [css-loader](https://github.com/webpack-contrib/css-loader) can be modified through `tools.cssLoader`.
|
18
18
|
|
19
|
-
import
|
19
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
20
20
|
|
21
|
-
<
|
21
|
+
<RsbuildConfig configName="tools.cssLoader" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: htmlPlugin
|
3
|
-
configName: tools.htmlPlugin
|
4
3
|
---
|
5
4
|
|
6
5
|
# tools.htmlPlugin
|
@@ -34,8 +33,13 @@ const defaultOptions = {
|
|
34
33
|
};
|
35
34
|
```
|
36
35
|
|
36
|
+
:::warning
|
37
|
+
SSR Application does not enable the `minify.removeComments` configuration, otherwise the SSR rendering will fail.
|
38
|
+
:::
|
39
|
+
|
40
|
+
|
37
41
|
The configs of [html-rspack-plugin](https://github.com/rspack-contrib/html-rspack-plugin) or [html-webpack-plugin](https://github.com/jantimon/html-webpack-plugin) can be modified through `tools.htmlPlugin`.
|
38
42
|
|
39
|
-
import
|
43
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
40
44
|
|
41
|
-
<
|
45
|
+
<RsbuildConfig configName="tools.htmlPlugin" />
|