@modern-js/main-doc 2.67.5 → 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/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/guides/advanced-features/_meta.json +0 -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/page-performance/_meta.json +1 -1
- package/docs/en/guides/advanced-features/page-performance/react-compiler.mdx +44 -0
- package/docs/en/guides/advanced-features/web-server.mdx +211 -20
- package/docs/en/guides/basic-features/deploy.mdx +3 -3
- package/docs/en/guides/basic-features/output-files.mdx +0 -28
- package/docs/en/tutorials/first-app/c04-routes.mdx +4 -2
- package/docs/en/tutorials/first-app/c05-loader.mdx +4 -1
- 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/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/guides/advanced-features/_meta.json +0 -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 +209 -25
- package/docs/zh/guides/basic-features/deploy.mdx +4 -3
- package/docs/zh/guides/basic-features/output-files.mdx +0 -28
- 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/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/en/guides/advanced-features/custom-server.mdx +0 -218
- 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
- package/docs/zh/guides/advanced-features/custom-server.mdx +0 -216
@@ -0,0 +1,10 @@
|
|
1
|
+
---
|
2
|
+
title: modern.server.[tj]s
|
3
|
+
sidebar_position: 1
|
4
|
+
---
|
5
|
+
|
6
|
+
# modern.server.[tj]s
|
7
|
+
|
8
|
+
This file extends the Modern.js Server. In this file, you can configure [Middleware](/guides/advanced-features/web-server.html#middleware), [RenderMiddleware](/guides/advanced-features/web-server.html#rendermiddleware), or [Plugin](/guides/advanced-features/web-server.html#plugin) for the Server that starts with the Modern.js project.
|
9
|
+
|
10
|
+
You can intercept and handle requests and responses, perform authentication and role checks, preprocess requests, and handle exceptions, etc. You can also insert specific business logic into the built-in processing logic (including route matching, resource addressing, header injection, page rendering, and static web hosting).
|
@@ -10,11 +10,11 @@ Conventional routing uses `routes/` as the convention for the entry point and an
|
|
10
10
|
|
11
11
|
Any `layout.[tj]sx` and `page.[tj]sx` under `src/routes` will be used as the application's routes:
|
12
12
|
|
13
|
-
```bash
|
13
|
+
```bash
|
14
14
|
.
|
15
15
|
└── routes
|
16
|
-
├── layout.tsx
|
17
|
-
├── page.tsx
|
16
|
+
├── layout.tsx # [!code highlight]
|
17
|
+
├── page.tsx # [!code highlight]
|
18
18
|
└── user
|
19
19
|
├── layout.tsx
|
20
20
|
└── page.tsx
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
title: useHonoContext
|
3
|
+
---
|
4
|
+
# useHonoContext
|
5
|
+
|
6
|
+
Used to obtain Hono context in an integrated BFF function.
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
```ts
|
11
|
+
import { useHonoContext } from '@modern-js/plugin-bff/hono';
|
12
|
+
```
|
13
|
+
|
14
|
+
## Function Signature
|
15
|
+
|
16
|
+
`function useHonoContext(): Context`
|
17
|
+
|
18
|
+
## Example
|
19
|
+
|
20
|
+
Developers can use `context` to obtain more request information, such as setting response headers:
|
21
|
+
|
22
|
+
```ts
|
23
|
+
import { useHonoContext } from '@modern-js/plugin-bff/hono';
|
24
|
+
|
25
|
+
export async function get() {
|
26
|
+
const c = useHonoContext();
|
27
|
+
c.res.headers.set('x-bff-api', 'true');
|
28
|
+
// ...
|
29
|
+
}
|
30
|
+
```
|
@@ -9,40 +9,14 @@ import { PackageManagerTabs } from '@theme';
|
|
9
9
|
```bash
|
10
10
|
? Please select the operation you want to perform Enable optional features
|
11
11
|
? Please select the feature to enable Enable "BFF"
|
12
|
-
? Please select BFF type Framework mode
|
13
12
|
```
|
14
13
|
|
15
|
-
:::note
|
16
|
-
Currently, it is recommended to create BFF in framework mode. We will remove the BFF type concept in the future.
|
17
|
-
:::
|
18
|
-
|
19
14
|
3. Depending on the chosen runtime framework, add the following code to `modern.config.[tj]s`:
|
20
15
|
|
21
|
-
import { Tabs, Tab as TabItem } from "@theme";
|
22
|
-
|
23
|
-
<Tabs>
|
24
|
-
<TabItem value="express" label="Express.js" default>
|
25
|
-
|
26
|
-
```ts title="modern.config.ts"
|
27
|
-
import { expressPlugin } from '@modern-js/plugin-express';
|
28
|
-
import { bffPlugin } from '@modern-js/plugin-bff';
|
29
|
-
|
30
|
-
export default defineConfig({
|
31
|
-
plugins: [expressPlugin(), bffPlugin()],
|
32
|
-
});
|
33
|
-
```
|
34
|
-
|
35
|
-
</TabItem>
|
36
|
-
<TabItem value="koa" label="Koa.js">
|
37
|
-
|
38
16
|
```ts title="modern.config.ts"
|
39
|
-
import { koaPlugin } from '@modern-js/plugin-koa';
|
40
17
|
import { bffPlugin } from '@modern-js/plugin-bff';
|
41
18
|
|
42
19
|
export default defineConfig({
|
43
|
-
plugins: [
|
20
|
+
plugins: [bffPlugin()],
|
44
21
|
});
|
45
22
|
```
|
46
|
-
|
47
|
-
</TabItem>
|
48
|
-
</Tabs>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import
|
1
|
+
import RsbuildLink from '@site/src/components/RsbuildLink';
|
2
2
|
|
3
3
|
:::info
|
4
|
-
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to <
|
4
|
+
The usage of this configuration item is exactly the same as that of Rsbuild. For detailed information, please refer to <RsbuildLink configName={props.configName}/>.
|
5
5
|
:::
|
@@ -1 +1 @@
|
|
1
|
-
Modern.js
|
1
|
+
Modern.js Server and BFF use [Hono.js](https://hono.dev/) as the runtime framework, and you can extend the Server based on the Hono.js ecosystem. Please refer to [Custom Web Server](/guides/advanced-features/web-server.html).
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: assetPrefix
|
3
|
-
configName: dev.assetPrefix
|
4
3
|
---
|
5
4
|
|
6
5
|
# dev.assetPrefix
|
@@ -10,9 +9,9 @@ configName: dev.assetPrefix
|
|
10
9
|
|
11
10
|
This configuration item is used to set the URL prefix of static resources in **development mode**.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="dev.assetPrefix" />
|
16
15
|
|
17
16
|
:::warning
|
18
17
|
Please note that this configuration item is only applicable in development mode. In production mode, please use the [output.assetPrefix](/configure/app/output/asset-prefix) configuration item for setting.
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: client
|
3
|
-
configName: dev.client
|
4
3
|
---
|
5
4
|
|
6
5
|
# dev.client
|
@@ -41,6 +40,6 @@ const defaultConfig = {
|
|
41
40
|
|
42
41
|
Configure the client code injected by Modern.js during the development process. This can be used to set the WebSocket URL for HMR.
|
43
42
|
|
44
|
-
import
|
43
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
45
44
|
|
46
|
-
<
|
45
|
+
<RsbuildConfig configName="dev.client" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: hmr
|
3
|
-
configName: dev.hmr
|
4
3
|
---
|
5
4
|
|
6
5
|
# dev.hmr
|
@@ -10,6 +9,6 @@ configName: dev.hmr
|
|
10
9
|
|
11
10
|
Whether to enable Hot Module Replacement.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="dev.hmr" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: liveReload
|
3
|
-
configName: dev.liveReload
|
4
3
|
---
|
5
4
|
|
6
5
|
# dev.liveReload
|
@@ -10,6 +9,6 @@ configName: dev.liveReload
|
|
10
9
|
|
11
10
|
Whether to reload the page when source files are changed.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="dev.liveReload" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: progressBar
|
3
|
-
configName: dev.progressBar
|
4
3
|
---
|
5
4
|
|
6
5
|
# dev.progressBar
|
@@ -19,6 +18,6 @@ type ProgressBar =
|
|
19
18
|
|
20
19
|
Whether to display progress bar during compilation.
|
21
20
|
|
22
|
-
import
|
21
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
23
22
|
|
24
|
-
<
|
23
|
+
<RsbuildConfig configName="dev.progressBar" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: setupMiddlewares
|
3
|
-
configName: dev.setupMiddlewares
|
4
3
|
---
|
5
4
|
|
6
5
|
# dev.setupMiddlewares
|
@@ -50,6 +49,6 @@ type SetupMiddlewares = Array<
|
|
50
49
|
|
51
50
|
Provides the ability to execute a custom function and apply custom middlewares.
|
52
51
|
|
53
|
-
import
|
52
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
54
53
|
|
55
|
-
<
|
54
|
+
<RsbuildConfig configName="dev.setupMiddlewares" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: watchFiles
|
3
|
-
configName: dev.watchFiles
|
4
3
|
---
|
5
4
|
|
6
5
|
# dev.watchFiles
|
@@ -27,6 +26,6 @@ type WatchFilesConfig = WatchFiles | WatchFiles[];
|
|
27
26
|
|
28
27
|
Watch specified files and directories for changes. When a file change is detected, it can trigger a page reload or restart the dev server.
|
29
28
|
|
30
|
-
import
|
29
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
31
30
|
|
32
|
-
<
|
31
|
+
<RsbuildConfig configName="dev.watchFiles" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: writeToDisk
|
3
|
-
configName: dev.writeToDisk
|
4
3
|
---
|
5
4
|
|
6
5
|
# dev.writeToDisk
|
@@ -10,6 +9,6 @@ configName: dev.writeToDisk
|
|
10
9
|
|
11
10
|
Controls whether the build output from development mode is written to disk.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="dev.writeToDisk" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: appIcon
|
3
|
-
configName: html.appIcon
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.appIcon
|
@@ -50,6 +49,6 @@ export default {
|
|
50
49
|
};
|
51
50
|
```
|
52
51
|
|
53
|
-
import
|
52
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
54
53
|
|
55
|
-
<
|
54
|
+
<RsbuildConfig configName="html.appIcon" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: crossorigin
|
3
|
-
configName: html.crossorigin
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.crossorigin
|
@@ -10,6 +9,6 @@ configName: html.crossorigin
|
|
10
9
|
|
11
10
|
Set the [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) attribute of the `<script>` and `<style>` tags.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="html.crossorigin" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: favicon
|
3
|
-
configName: html.favicon
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.favicon
|
@@ -16,6 +15,6 @@ Set the favicon icon path for all pages, can be set as:
|
|
16
15
|
|
17
16
|
After config this option, the favicon will be automatically copied to the dist directory during the compilation, and the corresponding `link` tag will be added to the HTML.
|
18
17
|
|
19
|
-
import
|
18
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
20
19
|
|
21
|
-
<
|
20
|
+
<RsbuildConfig configName="html.favicon" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: inject
|
3
|
-
configName: html.inject
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.inject
|
@@ -10,6 +9,6 @@ configName: html.inject
|
|
10
9
|
|
11
10
|
Set the inject position of the `<script>` tag.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="html.inject" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: meta
|
3
|
-
configName: html.meta
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.meta
|
@@ -24,6 +23,6 @@ const defaultMeta = {
|
|
24
23
|
|
25
24
|
Configure the `<meta>` tag of the HTML.
|
26
25
|
|
27
|
-
import
|
26
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
28
27
|
|
29
|
-
<
|
28
|
+
<RsbuildConfig configName="html.meta" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: mountId
|
3
|
-
configName: html.mountId
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.mountId
|
@@ -10,6 +9,6 @@ configName: html.mountId
|
|
10
9
|
|
11
10
|
By default, the `root` element is included in the HTML template for component mounting, and the element id can be modified through `mountId`.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="html.mountId" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: outputStructure
|
3
|
-
configName: html.outputStructure
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.outputStructure
|
@@ -10,6 +9,6 @@ configName: html.outputStructure
|
|
10
9
|
|
11
10
|
Define the directory structure of the HTML output files.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="html.outputStructure" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: scriptLoading
|
3
|
-
configName: html.scriptLoading
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.scriptLoading
|
@@ -10,6 +9,6 @@ configName: html.scriptLoading
|
|
10
9
|
|
11
10
|
Used to set how `<script>` tags are loaded.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="html.scriptLoading" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: tags
|
3
|
-
configName: html.tags
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.tags
|
@@ -15,6 +14,6 @@ type TagsConfig = HtmlTag | HtmlTagHandler | Array<HtmlTag | HtmlTagHandler>;
|
|
15
14
|
|
16
15
|
Modifies the tags that are injected into the HTML page.
|
17
16
|
|
18
|
-
import
|
17
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
19
18
|
|
20
|
-
<
|
19
|
+
<RsbuildConfig configName="html.tags" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: templateParameters
|
3
|
-
configName: html.templateParameters
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.templateParameters
|
@@ -33,6 +32,6 @@ type DefaultParameters = {
|
|
33
32
|
|
34
33
|
Define the parameters in the HTML template, corresponding to the `templateParameters` config of [html-rspack-plugin](https://github.com/rspack-contrib/html-rspack-plugin). You can use the config as an object or a function.
|
35
34
|
|
36
|
-
import
|
35
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
37
36
|
|
38
|
-
<
|
37
|
+
<RsbuildConfig configName="html.templateParameters" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: template
|
3
|
-
configName: html.template
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.template
|
@@ -10,6 +9,6 @@ configName: html.template
|
|
10
9
|
|
11
10
|
Specifies the file path for the HTML template, which can be a relative or absolute path.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="html.template" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: title
|
3
|
-
configName: html.title
|
4
3
|
---
|
5
4
|
|
6
5
|
# html.title
|
@@ -18,6 +17,6 @@ export default {
|
|
18
17
|
};
|
19
18
|
```
|
20
19
|
|
21
|
-
import
|
20
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
22
21
|
|
23
|
-
<
|
22
|
+
<RsbuildConfig configName="html.title" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: assetPrefix
|
3
|
-
configName: output.assetPrefix
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.assetPrefix
|
@@ -14,6 +13,6 @@ import OutputAssetPrefixExtend from '@site-docs-en/components/output-asset-prefi
|
|
14
13
|
|
15
14
|
<OutputAssetPrefixExtend />
|
16
15
|
|
17
|
-
import
|
16
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
18
17
|
|
19
|
-
<
|
18
|
+
<RsbuildConfig configName="output.assetPrefix" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: charset
|
3
|
-
configName: output.charset
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.charset
|
@@ -10,6 +9,6 @@ configName: output.charset
|
|
10
9
|
|
11
10
|
The `charset` config allows you to specify the [character encoding](https://developer.mozilla.org/en-US/docs/Glossary/Character_encoding) for output files to ensure they are displayed correctly in different environments.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="output.charset" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: copy
|
3
|
-
configName: output.copy
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.copy
|
@@ -10,6 +9,6 @@ configName: output.copy
|
|
10
9
|
|
11
10
|
Copies the specified file or directory to the dist directory, implemented based on [rspack.CopyRspackPlugin](https://rspack.dev/zh/plugins/rspack/copy-rspack-plugin).
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="output.copy" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: cssModules
|
3
|
-
configName: output.cssModules
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.cssModules
|
@@ -48,6 +47,6 @@ const defaultCssModules = {
|
|
48
47
|
|
49
48
|
For custom CSS Modules configuration.
|
50
49
|
|
51
|
-
import
|
50
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
52
51
|
|
53
|
-
<
|
52
|
+
<RsbuildConfig configName="output.cssModules" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: dataUriLimit
|
3
|
-
configName: output.dataUriLimit
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.dataUriLimit
|
@@ -26,6 +25,6 @@ const defaultDatUriLimit = 10000;
|
|
26
25
|
|
27
26
|
Set the size threshold to inline static assets such as images and fonts.
|
28
27
|
|
29
|
-
import
|
28
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
30
29
|
|
31
|
-
<
|
30
|
+
<RsbuildConfig configName="output.dataUriLimit" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: distPath
|
3
|
-
configName: output.distPath
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.distPath
|
@@ -18,7 +17,6 @@ type DistPathConfig = {
|
|
18
17
|
wasm?: string;
|
19
18
|
image?: string;
|
20
19
|
media?: string;
|
21
|
-
server?: string;
|
22
20
|
worker?: string;
|
23
21
|
assets?: string;
|
24
22
|
};
|
@@ -43,6 +41,6 @@ const defaultDistPath = {
|
|
43
41
|
|
44
42
|
Set the directory of the dist files. Modern.js will output files to the corresponding subdirectory according to the file type.
|
45
43
|
|
46
|
-
import
|
44
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
47
45
|
|
48
|
-
<
|
46
|
+
<RsbuildConfig configName="output.distPath" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: externals
|
3
|
-
configName: output.externals
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.externals
|
@@ -20,6 +19,6 @@ type Externals =
|
|
20
19
|
|
21
20
|
At build time, prevent some `import` dependencies from being packed into bundles in your code, and instead fetch them externally at runtime.
|
22
21
|
|
23
|
-
import
|
22
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
24
23
|
|
25
|
-
<
|
24
|
+
<RsbuildConfig configName="output.externals" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: filenameHash
|
3
|
-
configName: output.filenameHash
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.filenameHash
|
@@ -10,6 +9,6 @@ configName: output.filenameHash
|
|
10
9
|
|
11
10
|
Whether to add a hash value to the filename after the production build.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="output.filenameHash" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: filename
|
3
|
-
configName: output.filename
|
4
3
|
---
|
5
4
|
|
6
5
|
:::warning
|
@@ -57,6 +56,6 @@ const prodDefaultFilename = {
|
|
57
56
|
|
58
57
|
Sets the filename of dist files.
|
59
58
|
|
60
|
-
import
|
59
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
61
60
|
|
62
|
-
<
|
61
|
+
<RsbuildConfig configName="output.filename" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: injectStyles
|
3
|
-
configName: output.injectStyles
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.injectStyles
|
@@ -10,6 +9,6 @@ configName: output.injectStyles
|
|
10
9
|
|
11
10
|
Whether to inject styles into DOM.
|
12
11
|
|
13
|
-
import
|
12
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
14
13
|
|
15
|
-
<
|
14
|
+
<RsbuildConfig configName="output.injectStyles" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: inlineScripts
|
3
|
-
configName: output.inlineScripts
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.inlineScripts
|
@@ -29,6 +28,6 @@ Whether to inline output scripts files (.js files) into HTML with `<script>` tag
|
|
29
28
|
When using convention-based routing, you need to set [output.splitRouteChunks](/configure/app/output/split-route-chunks) to false if this option is turned on.
|
30
29
|
:::
|
31
30
|
|
32
|
-
import
|
31
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
33
32
|
|
34
|
-
<
|
33
|
+
<RsbuildConfig configName="output.inlineScripts" />
|
@@ -1,6 +1,5 @@
|
|
1
1
|
---
|
2
2
|
title: inlineStyles
|
3
|
-
configName: output.inlineStyles
|
4
3
|
---
|
5
4
|
|
6
5
|
# output.inlineStyles
|
@@ -29,6 +28,6 @@ Whether to inline output style files (.css files) into HTML with `<style>` tags.
|
|
29
28
|
When using convention-based routing, you need to set [output.splitRouteChunks](/configure/app/output/split-route-chunks) to false if this option is turned on.
|
30
29
|
:::
|
31
30
|
|
32
|
-
import
|
31
|
+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
|
33
32
|
|
34
|
-
<
|
33
|
+
<RsbuildConfig configName="output.inlineStyles" />
|