@bleedingdev/modern-js-app-tools 3.9.0-ultramodern.9 → 3.9.3-ultramodern.10
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/bin/modern-bundle-docs.js +2 -2
- package/bin/modern.js +2 -2
- package/dist/cjs/builder/generator/createCopyPattern.js +2 -1
- package/dist/cjs/builder/index.js +4 -0
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +2 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +11 -6
- package/dist/cjs/builder/shared/lazyCompilation.js +26 -0
- package/dist/cjs/commands/build.js +1 -2
- package/dist/cjs/commands/deploy.js +1 -3
- package/dist/cjs/commands/index.js +10 -2
- package/dist/cjs/compat/hooks.js +1 -1
- package/dist/cjs/esm/ts-paths-loader.js +5 -4
- package/dist/cjs/esm/ts-paths-loader.mjs +5 -4
- package/dist/cjs/index.js +73 -99
- package/dist/cjs/plugins/analyze/getFileSystemEntry.js +1 -1
- package/dist/cjs/plugins/analyze/getServerRoutes.js +2 -2
- package/dist/cjs/plugins/analyze/index.js +2 -2
- package/dist/cjs/plugins/analyze/utils.js +6 -6
- package/dist/cjs/plugins/deploy/index.js +7 -28
- package/dist/cjs/plugins/deploy/platforms/netlify.js +2 -1
- package/dist/cjs/plugins/deploy/platforms/node.js +12 -3
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.cjs +3 -2
- package/dist/cjs/plugins/deploy/platforms/templates/node-entry.mjs +3 -2
- package/dist/cjs/plugins/deploy/platforms/vercel.js +2 -1
- package/dist/cjs/plugins/deploy/utils/index.js +15 -12
- package/dist/cjs/plugins/initialize/index.js +6 -5
- package/dist/cjs/plugins/serverBuild.js +0 -2
- package/dist/cjs/run/index.js +5 -5
- package/dist/cjs/types/config/base.js +62 -0
- package/dist/cjs/types/plugin-base.js +18 -0
- package/dist/cjs/types/plugin.js +46 -2
- package/dist/cjs/utils/initAppContext.js +1 -1
- package/dist/cjs/utils/loadPlugins.js +13 -7
- package/dist/cjs/utils/register.js +1 -1
- package/dist/esm/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm/builder/index.mjs +1 -0
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.mjs +9 -7
- package/dist/esm/builder/shared/lazyCompilation.mjs +14 -1
- package/dist/esm/commands/build.mjs +1 -2
- package/dist/esm/commands/deploy.mjs +1 -3
- package/dist/esm/commands/index.mjs +10 -2
- package/dist/esm/compat/hooks.mjs +1 -1
- package/dist/esm/esm/ts-paths-loader.mjs +5 -4
- package/dist/esm/index.mjs +9 -18
- package/dist/esm/plugins/analyze/getFileSystemEntry.mjs +1 -1
- package/dist/esm/plugins/analyze/getServerRoutes.mjs +2 -2
- package/dist/esm/plugins/analyze/index.mjs +2 -2
- package/dist/esm/plugins/analyze/utils.mjs +7 -7
- package/dist/esm/plugins/deploy/index.mjs +5 -21
- package/dist/esm/plugins/deploy/platforms/netlify.mjs +2 -1
- package/dist/esm/plugins/deploy/platforms/node.mjs +12 -3
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.cjs +3 -2
- package/dist/esm/plugins/deploy/platforms/templates/node-entry.mjs +3 -2
- package/dist/esm/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm/plugins/deploy/utils/index.mjs +17 -14
- package/dist/esm/plugins/initialize/index.mjs +6 -5
- package/dist/esm/plugins/serverBuild.mjs +0 -2
- package/dist/esm/run/index.mjs +5 -5
- package/dist/esm/types/config/base.mjs +1 -0
- package/dist/esm/types/plugin-base.mjs +0 -0
- package/dist/esm/types/plugin.mjs +1 -0
- package/dist/esm/utils/initAppContext.mjs +2 -2
- package/dist/esm/utils/loadPlugins.mjs +4 -8
- package/dist/esm/utils/register.mjs +1 -1
- package/dist/esm-node/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm-node/builder/index.mjs +1 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.mjs +9 -7
- package/dist/esm-node/builder/shared/lazyCompilation.mjs +14 -1
- package/dist/esm-node/commands/build.mjs +1 -2
- package/dist/esm-node/commands/deploy.mjs +1 -3
- package/dist/esm-node/commands/index.mjs +10 -2
- package/dist/esm-node/compat/hooks.mjs +1 -1
- package/dist/esm-node/esm/ts-paths-loader.mjs +5 -4
- package/dist/esm-node/index.mjs +10 -20
- package/dist/esm-node/plugins/analyze/getFileSystemEntry.mjs +1 -1
- package/dist/esm-node/plugins/analyze/getServerRoutes.mjs +2 -2
- package/dist/esm-node/plugins/analyze/index.mjs +2 -2
- package/dist/esm-node/plugins/analyze/utils.mjs +7 -7
- package/dist/esm-node/plugins/deploy/index.mjs +5 -21
- package/dist/esm-node/plugins/deploy/platforms/netlify.mjs +2 -1
- package/dist/esm-node/plugins/deploy/platforms/node.mjs +12 -3
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.cjs +3 -2
- package/dist/esm-node/plugins/deploy/platforms/templates/node-entry.mjs +3 -2
- package/dist/esm-node/plugins/deploy/platforms/vercel.mjs +2 -1
- package/dist/esm-node/plugins/deploy/utils/index.mjs +17 -15
- package/dist/esm-node/plugins/initialize/index.mjs +6 -5
- package/dist/esm-node/plugins/serverBuild.mjs +0 -2
- package/dist/esm-node/run/index.mjs +5 -5
- package/dist/esm-node/types/config/base.mjs +2 -0
- package/dist/esm-node/types/plugin-base.mjs +1 -0
- package/dist/esm-node/types/plugin.mjs +1 -0
- package/dist/esm-node/utils/initAppContext.mjs +2 -2
- package/dist/esm-node/utils/loadPlugins.mjs +4 -8
- package/dist/esm-node/utils/register.mjs +1 -1
- package/dist/types/builder/index.d.ts +1 -0
- package/dist/types/builder/shared/builderPlugins/adapterBasic.d.ts +4 -2
- package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +2 -1
- package/dist/types/builder/shared/builderPlugins/builderHooks.d.ts +10 -2
- package/dist/types/builder/shared/lazyCompilation.d.ts +15 -0
- package/dist/types/compat/hooks.d.ts +3 -2
- package/dist/types/index.d.ts +1 -3
- package/dist/types/plugins/analyze/getBundleEntry.d.ts +5 -4
- package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +5 -4
- package/dist/types/plugins/analyze/utils.d.ts +2 -2
- package/dist/types/plugins/deploy/index.d.ts +1 -4
- package/dist/types/plugins/deploy/utils/index.d.ts +1 -1
- package/dist/types/run/index.d.ts +1 -1
- package/dist/types/types/config/base.d.ts +58 -0
- package/dist/types/types/config/deploy.d.ts +2 -50
- package/dist/types/types/config/dev.d.ts +1 -1
- package/dist/types/types/config/index.d.ts +18 -42
- package/dist/types/types/config/output.d.ts +2 -2
- package/dist/types/types/config/testing.d.ts +1 -1
- package/dist/types/types/config/tools.d.ts +1 -1
- package/dist/types/types/plugin-base.d.ts +188 -0
- package/dist/types/types/plugin.d.ts +9 -183
- package/dist/types/utils/initAppContext.d.ts +1 -1
- package/docs/apis/app/commands.md +1 -0
- package/docs/configure/app/bff/effect.md +5 -12
- package/docs/configure/app/output/disable-css-module-extension.md +3 -3
- package/docs/configure/app/output/disable-svgr.md +4 -0
- package/docs/configure/app/output/svg-default-export.md +4 -0
- package/docs/configure/app/server/routes.md +1 -1
- package/docs/configure/app/server/ssr.md +1 -1
- package/docs/configure/app/source/react-compiler.md +2 -0
- package/docs/configure/app/tools/less.md +94 -19
- package/docs/configure/app/tools/sass.md +87 -18
- package/docs/configure/app/tools/svgr.md +91 -0
- package/docs/configure/app/tools/swc.md +2 -2
- package/docs/configure/app/tools/ts-checker.md +7 -21
- package/docs/guides/advanced-features/server-monitor/logger.md +5 -5
- package/docs/guides/basic-features/env-vars.md +6 -6
- package/docs/guides/basic-features/render/ssr-cache.md +14 -1
- package/docs/guides/basic-features/static-assets/svg-assets.md +29 -17
- package/docs/guides/basic-features/testing/rstest.md +0 -2
- package/docs/guides/get-started/quick-start.md +1 -1
- package/docs/guides/get-started/ultramodern.md +45 -14
- package/docs/llms.txt +4 -3
- package/docs/plugin/introduction.md +10 -10
- package/docs/plugin/server-plugins/api.md +1 -0
- package/package.json +59 -30
- package/dist/cjs/plugins/serverRuntime.js +0 -53
- package/dist/esm/plugins/serverRuntime.mjs +0 -15
- package/dist/esm-node/plugins/serverRuntime.mjs +0 -16
- package/dist/types/plugins/serverRuntime.d.ts +0 -3
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.
|
|
2
|
+
|
|
3
|
+
# tools.svgr
|
|
4
|
+
|
|
5
|
+
- **Type:** `Object | Function | false`
|
|
6
|
+
- **Default:**
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
const defaultOptions = {
|
|
10
|
+
mixedImport: true,
|
|
11
|
+
svgrOptions: {
|
|
12
|
+
exportType: 'named',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`tools.svgr` modifies the options of [@rsbuild/plugin-svgr](https://rsbuild.rs/plugins/list/plugin-svgr). It accepts the full plugin options. Set it to `false` to skip registering the SVGR plugin; all `.svg` files are then treated as static assets.
|
|
18
|
+
|
|
19
|
+
| Option | Description |
|
|
20
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
21
|
+
| `svgrOptions` | Options passed to [SVGR](https://react-svgr.com/docs/options/), such as `exportType`, `icon`, `svgoConfig` |
|
|
22
|
+
| `parallel` | Whether to transform SVG files in worker threads, defaults to `false` |
|
|
23
|
+
| `exclude` | SVG files that SVGR should skip |
|
|
24
|
+
| `excludeImporter` | Importer files whose SVG imports should skip SVGR |
|
|
25
|
+
| `query` | Query that triggers the SVGR transform, defaults to `/react/` |
|
|
26
|
+
| `mixedImport` | Whether a module may import both the URL and the React component, defaults to `true` |
|
|
27
|
+
|
|
28
|
+
### Merge rules
|
|
29
|
+
|
|
30
|
+
When `tools.svgr` is an `Object`, its top-level fields are merged with the defaults through Object.assign in a shallow way, and `svgrOptions` is merged one level deeper, so setting only `svgrOptions.icon` keeps the default `exportType`.
|
|
31
|
+
|
|
32
|
+
When `tools.svgr` is a `Function`, the default config is passed as the first parameter, which can be directly modified or returned as the final result. An array of objects and functions is also accepted and applied in order.
|
|
33
|
+
|
|
34
|
+
### Parallel transform
|
|
35
|
+
|
|
36
|
+
The SVGR transform is pure JavaScript and runs on the Node.js main thread by default. With many SVG files, enable `parallel` to move the transform into a pool of worker threads:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
export default {
|
|
40
|
+
tools: {
|
|
41
|
+
svgr: {
|
|
42
|
+
parallel: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
:::tip
|
|
49
|
+
Options sent to worker threads must satisfy the [structured clone algorithm](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm). With `parallel` enabled, `svgrOptions` therefore cannot contain functions.
|
|
50
|
+
:::
|
|
51
|
+
|
|
52
|
+
### Changing the default export
|
|
53
|
+
|
|
54
|
+
`svgrOptions.exportType` controls what an SVG file exports by default: `'named'` exports the file URL by default and the React component as the named export `ReactComponent`; `'default'` exports the React component by default.
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
export default {
|
|
58
|
+
tools: {
|
|
59
|
+
svgr: {
|
|
60
|
+
svgrOptions: {
|
|
61
|
+
exportType: 'default',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Disabling SVGR
|
|
69
|
+
|
|
70
|
+
If you are sure that no SVG asset in your project is used as a React component, disable SVGR to improve build performance:
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
export default {
|
|
74
|
+
tools: {
|
|
75
|
+
svgr: false,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Relation to the legacy options
|
|
81
|
+
|
|
82
|
+
`tools.svgr` replaces the two deprecated options below. They still work today and will be removed in the next major version:
|
|
83
|
+
|
|
84
|
+
| Legacy option | Replacement |
|
|
85
|
+
| -------------------------------------- | -------------------------------------------------------- |
|
|
86
|
+
| `output.svgDefaultExport: 'component'` | `tools.svgr: { svgrOptions: { exportType: 'default' } }` |
|
|
87
|
+
| `output.svgDefaultExport: 'url'` | `tools.svgr: { svgrOptions: { exportType: 'named' } }` |
|
|
88
|
+
| `output.disableSvgr: true` | `tools.svgr: false` |
|
|
89
|
+
| `output.disableSvgr: false` | Default behavior, just remove it |
|
|
90
|
+
|
|
91
|
+
When both are set, `tools.svgr` wins: once `tools.svgr` is set explicitly, `output.disableSvgr` no longer applies, and `tools.svgr.svgrOptions.exportType` overrides the value derived from `output.svgDefaultExport`.
|
|
@@ -53,9 +53,9 @@ export default {
|
|
|
53
53
|
};
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
Please note that the SWC plugin is still an experimental feature, and the SWC Wasm plugin is currently not backward compatible. The version of the SWC plugin is closely tied to the version of
|
|
56
|
+
Please note that the SWC plugin is still an experimental feature, and the SWC Wasm plugin is currently not backward compatible. The version of the SWC plugin is closely tied to the version of swc_core that Rspack depends on.
|
|
57
57
|
|
|
58
|
-
This means that you must to choose an SWC plugin that matches the current version of
|
|
58
|
+
This means that you must to choose an SWC plugin that matches the current version of swc_core to ensure that it works properly. If the version of the SWC plugin you are using does not match the version of swc_core that Rspack depends on, Rspack will throw the following error during the build process:
|
|
59
59
|
|
|
60
60
|
```
|
|
61
61
|
1: failed to run Wasm plugin transform. Please ensure the version of `swc_core`
|
|
@@ -76,43 +76,29 @@ export default {
|
|
|
76
76
|
|
|
77
77
|
Type checking runs on [TypeScript Go](https://github.com/microsoft/typescript-go) (`tsgo`) by default in this fork. The capability is provided by [`ts-checker-rspack-plugin`](https://github.com/rstackjs/ts-checker-rspack-plugin), which is integrated by [`@rsbuild/plugin-type-check`](https://github.com/rstackjs/rsbuild-plugin-type-check), and reduces type-checking time by about 5-10x.
|
|
78
78
|
|
|
79
|
-
Modern.js
|
|
79
|
+
Modern.js uses the native Go compiler from stable `typescript@7.0.2`. It resolves the project's package first, then the builder's declared dependency, and rejects incompatible versions. To install the supported compiler in your project:
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
```sh [npm]
|
|
83
|
-
npm install typescript -D
|
|
83
|
+
npm install typescript@7.0.2 -D
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
```sh [yarn]
|
|
87
|
-
yarn add typescript -D
|
|
87
|
+
yarn add typescript@7.0.2 -D
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
```sh [pnpm]
|
|
91
|
-
pnpm add typescript -D
|
|
91
|
+
pnpm add typescript@7.0.2 -D
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
```sh [bun]
|
|
95
|
-
bun add typescript -D
|
|
95
|
+
bun add typescript@7.0.2 -D
|
|
96
96
|
```
|
|
97
97
|
|
|
98
98
|
```sh [deno]
|
|
99
|
-
deno add npm:typescript -D
|
|
99
|
+
deno add npm:typescript@7.0.2 -D
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
To fall back to the classic TypeScript checker, set `typescript.tsgo` to `false` and make sure `typescript` is installed in your project:
|
|
105
|
-
|
|
106
|
-
```ts
|
|
107
|
-
export default {
|
|
108
|
-
tools: {
|
|
109
|
-
tsChecker: {
|
|
110
|
-
typescript: {
|
|
111
|
-
tsgo: false,
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
```
|
|
102
|
+
The default `typescript.typescriptPath` resolves to the absolute path of `typescript/package.json` for that stable compiler.
|
|
117
103
|
|
|
118
104
|
For supported options and limitations, please refer to [ts-checker-rspack-plugin - TypeScript Go support](https://github.com/rstackjs/ts-checker-rspack-plugin#typescript-go-support).
|
|
@@ -8,11 +8,11 @@ Log events are distributed by Modern.js as events of type `log`.
|
|
|
8
8
|
|
|
9
9
|
Based on server-side runtime logic, Modern.js provides the following log events:
|
|
10
10
|
|
|
11
|
-
| Stage
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
11
|
+
| Stage | Message | Level |
|
|
12
|
+
| ------------- | --------------------------------------------- | ----- |
|
|
13
|
+
| RENDER_HTML | App Render To HTML | error |
|
|
14
|
+
| RENDER_STREAM | An error occurs during streaming SSR | error |
|
|
15
|
+
| RENDER_SHELL | An error occurs during streaming render shell | error |
|
|
16
16
|
|
|
17
17
|
## Built-in Monitor
|
|
18
18
|
|
|
@@ -6,27 +6,27 @@ Modern.js provides support for environment variables, including built-in environ
|
|
|
6
6
|
|
|
7
7
|
## Built-in Environment Variables
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### ASSET_PREFIX
|
|
10
10
|
|
|
11
11
|
The current path prefix of the asset, which is a read-only environment variable.
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### NODE_ENV
|
|
14
14
|
|
|
15
15
|
The current execution environment and is a **read-only** environment variable whose have different values under different execution commands:
|
|
16
16
|
|
|
17
17
|
- `production`: Default value when running `modern build` or `modern serve`.
|
|
18
18
|
- `development`: Default value when running `modern dev`, also the default value in other cases.
|
|
19
19
|
|
|
20
|
-
###
|
|
20
|
+
### MODERN_ENV
|
|
21
21
|
|
|
22
|
-
Set the current execution environment manually. In addition to the values in the
|
|
22
|
+
Set the current execution environment manually. In addition to the values in the NODE_ENV, custom environment names are supported here, such as `staging`, `boe`, etc.
|
|
23
23
|
|
|
24
24
|
:::tip
|
|
25
|
-
|
|
25
|
+
MODERN_ENV priority is higher than NODE_ENV.
|
|
26
26
|
|
|
27
27
|
:::
|
|
28
28
|
|
|
29
|
-
###
|
|
29
|
+
### MODERN_TARGET
|
|
30
30
|
|
|
31
31
|
When using `@modern-js/runtime`, Modern.js will automatically inject `MODERN_TARGET` to distinguish between SSR and CSR environments.
|
|
32
32
|
|
|
@@ -37,7 +37,7 @@ export interface CacheControl {
|
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Here, `customKey` is the custom cache key. By default,
|
|
40
|
+
Here, `customKey` is the custom cache key. By default, the cache key is derived from the request's origin, normalized pathname (trailing slash removed), and query string. When `customKey` is set, it fully replaces the default key: the `customKey` callback receives the normalized pathname (not the `CacheOptionProvider`'s `req`) and is responsible for the whole partition (e.g. by tenant, host, or query) — it must not embed raw cookies or other credentials into the returned key.
|
|
41
41
|
|
|
42
42
|
**Function Type**
|
|
43
43
|
|
|
@@ -108,6 +108,19 @@ export const cacheOption: CacheOption = {
|
|
|
108
108
|
|
|
109
109
|
The above `/home` and `/about` are patterns, meaning `/home/abc` will also match. You can use regex in these patterns, such as `/home/.+`.
|
|
110
110
|
|
|
111
|
+
### Cache Policy
|
|
112
|
+
|
|
113
|
+
The following policy is enforced automatically and cannot be overridden by the returned `CacheControl`:
|
|
114
|
+
|
|
115
|
+
- Only `GET` requests are cached.
|
|
116
|
+
- A request carrying a `Cookie` or `Authorization` header skips the cache unless `customKey` is set, since a custom key is treated as an explicit partitioning contract.
|
|
117
|
+
- A request with `Cache-Control: private`, `no-cache`, or `no-store` skips the cache.
|
|
118
|
+
- A response is only stored when it is `200`, has no `private`/`no-cache`/`no-store` in `Cache-Control`, has no `Set-Cookie`, and has no nonempty `Vary` header; otherwise any existing cache entry for that key is deleted instead of being written.
|
|
119
|
+
- If a `stale` revalidation produces a response that is no longer cacheable (for example, it became per-user), that already-served stale response is unaffected, but the cache entry is evicted so subsequent requests no longer hit it.
|
|
120
|
+
- A `CacheOptionProvider` returning `false` still disables caching entirely for that request, independent of the policy above.
|
|
121
|
+
|
|
122
|
+
Cache keys are namespaced (`__ssr__cache:v2:...`). Older un-namespaced entries — including ones already stored in a custom `Container` — are never read back; they simply age out under the container's own eviction/TTL. There is no global cache flush.
|
|
123
|
+
|
|
111
124
|
### Cache Container
|
|
112
125
|
|
|
113
126
|
By default, the server uses memory for caching. Typically, services are deployed in a Serverless container, creating a new process for each access, making it impossible to use the previous cache.
|
|
@@ -40,16 +40,22 @@ export default () => <Logo />;
|
|
|
40
40
|
|
|
41
41
|
## Modify the Default Export
|
|
42
42
|
|
|
43
|
-
You can modify the default export of SVG files through
|
|
43
|
+
You can modify the default export of SVG files through `svgrOptions.exportType` of [tools.svgr](/configure/app/tools/svgr.md). For example, set the default export as a React component:
|
|
44
44
|
|
|
45
45
|
```ts
|
|
46
46
|
export default {
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
tools: {
|
|
48
|
+
svgr: {
|
|
49
|
+
svgrOptions: {
|
|
50
|
+
exportType: 'default',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
49
53
|
},
|
|
50
54
|
};
|
|
51
55
|
```
|
|
52
56
|
|
|
57
|
+
The legacy [output.svgDefaultExport](/configure/app/output/svg-default-export.md) config still works but is deprecated.
|
|
58
|
+
|
|
53
59
|
Then import the SVG, you'll get a React component instead of a URL:
|
|
54
60
|
|
|
55
61
|
```tsx title="src/component/Logo.tsx"
|
|
@@ -76,12 +82,12 @@ Please read the [Import Static Assets](/guides/basic-features/static-assets.md)
|
|
|
76
82
|
|
|
77
83
|
## Disable SVGR Processing
|
|
78
84
|
|
|
79
|
-
By default, when an SVG resource is referenced in a JS file, Modern.js will call SVGR to convert the SVG into a React component. If you are sure that all SVG resources in your project are not being used as React components, you can turn off this conversion by setting [
|
|
85
|
+
By default, when an SVG resource is referenced in a JS file, Modern.js will call SVGR to convert the SVG into a React component. If you are sure that all SVG resources in your project are not being used as React components, you can turn off this conversion by setting [tools.svgr](/configure/app/tools/svgr.md) to `false` to improve build performance.
|
|
80
86
|
|
|
81
87
|
```js
|
|
82
88
|
export default {
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
tools: {
|
|
90
|
+
svgr: false,
|
|
85
91
|
},
|
|
86
92
|
};
|
|
87
93
|
```
|
|
@@ -149,21 +155,27 @@ When SVGR is enabled, its default configuration is as follows:
|
|
|
149
155
|
}
|
|
150
156
|
```
|
|
151
157
|
|
|
152
|
-
|
|
158
|
+
To modify the SVGR configuration, use `svgrOptions` of [tools.svgr](/configure/app/tools/svgr.md). The `svgoConfig.plugins` you pass are deep merged with the defaults by plugin name, so only the changed part needs to be written:
|
|
153
159
|
|
|
154
160
|
```js
|
|
155
161
|
export default {
|
|
156
162
|
tools: {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
svgr: {
|
|
164
|
+
svgrOptions: {
|
|
165
|
+
svgoConfig: {
|
|
166
|
+
plugins: [
|
|
167
|
+
{
|
|
168
|
+
name: 'preset-default',
|
|
169
|
+
params: {
|
|
170
|
+
overrides: {
|
|
171
|
+
// add one more override on top of the default preset-default
|
|
172
|
+
removeUselessDefs: false,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
167
179
|
},
|
|
168
180
|
},
|
|
169
181
|
};
|
|
@@ -48,13 +48,46 @@ UltraModern.js uses Effect HttpApi, TanStack Router, SSR, and independently depl
|
|
|
48
48
|
## Create and Validate a Workspace
|
|
49
49
|
|
|
50
50
|
```bash
|
|
51
|
-
pnpm dlx @bleedingdev/modern-js-ultramodern-create
|
|
51
|
+
pnpm dlx @bleedingdev/modern-js-ultramodern-create@<V> my-workspace --renderer react
|
|
52
|
+
cd my-workspace
|
|
52
53
|
mise install
|
|
53
54
|
mise exec -- pnpm install
|
|
54
55
|
mise exec -- pnpm check
|
|
55
56
|
mise exec -- pnpm build
|
|
56
57
|
```
|
|
57
58
|
|
|
59
|
+
Replace `<V>` with the published framework version. Omit `--renderer` to use
|
|
60
|
+
React, or select `solid` or `octane` during initial generation. Add commands
|
|
61
|
+
read the application's `modern.config.ts` instead of accepting `--renderer`.
|
|
62
|
+
|
|
63
|
+
### Select the application renderer
|
|
64
|
+
|
|
65
|
+
Use the fork's config entrypoint; it owns the selected plugin composition:
|
|
66
|
+
|
|
67
|
+
```ts title="modern.config.ts"
|
|
68
|
+
import { defineConfig } from '@modern-js/ultramodern-app-tools';
|
|
69
|
+
|
|
70
|
+
export default defineConfig({
|
|
71
|
+
renderer: 'solid', // 'react' or 'octane'; omitted means 'react'
|
|
72
|
+
server: { ssr: true },
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Solid 2.0.0-rc.13 and Octane are Node previews for CSR, native streaming SSR,
|
|
77
|
+
hydration and managed filesystem routes. Use Node 26.7.0 or newer. Author
|
|
78
|
+
components with `solid-js` / `@solidjs/web` or `octane`, and import native router
|
|
79
|
+
primitives from `@modern-js/renderer-solid/router` or
|
|
80
|
+
`@modern-js/renderer-octane/router`. Generated entries own mounting and hydration.
|
|
81
|
+
Changing the selector requires matching native source and dependencies, a
|
|
82
|
+
dev-server restart and a document reload.
|
|
83
|
+
|
|
84
|
+
Native previews reject workers, Module Federation, RSC, SSG, React i18n
|
|
85
|
+
integration, SVG component imports and CSS declaration emission beside authored
|
|
86
|
+
source. SVG URLs remain supported. The
|
|
87
|
+
[application tools README](https://github.com/BleedingDev/ultramodern.js/tree/main/packages/solutions/ultramodern-app-tools#readme)
|
|
88
|
+
defines the current preview profile and pinned dependencies. The federation,
|
|
89
|
+
i18n and Cloudflare examples below describe the React profile.
|
|
90
|
+
|
|
58
91
|
Localized Cloudflare SSR workspaces redirect `/` on the server to the negotiated locale. For example, `Accept-Language: cs-CZ` returns `302` with `Location: /cs`, `Cache-Control: private, no-store`, and `Vary` covering locale detection headers. Validate the deployed Worker with:
|
|
59
92
|
|
|
60
93
|
```bash
|
|
@@ -62,26 +95,24 @@ curl -I -H 'Accept-Language: cs-CZ,cs;q=0.9,en;q=0.1' https://<worker-host>/
|
|
|
62
95
|
```
|
|
63
96
|
|
|
64
97
|
Generated strict Effect workspaces pin the compatible Effect cohort with pnpm
|
|
65
|
-
overrides: `effect@4.0.0-rc.
|
|
66
|
-
and `@effect/vitest@4.0.0-rc.
|
|
98
|
+
overrides: `effect@4.0.0-rc.117`, `@effect/opentelemetry@4.0.0-rc.117`,
|
|
99
|
+
and `@effect/vitest@4.0.0-rc.117`. Do not add app-local direct Effect
|
|
67
100
|
versions that disagree with those overrides. The strict 24-hour release-age
|
|
68
101
|
gate applies to installed packages; this cohort carries no Effect age
|
|
69
102
|
exemption, and override-only `@effect/vitest` is not an installed approval
|
|
70
|
-
target.
|
|
71
|
-
and `@effect/opentelemetry` cover their trusted-publisher to provenance
|
|
72
|
-
metadata transition; they are not release-age approvals.
|
|
103
|
+
target.
|
|
73
104
|
|
|
74
105
|
### Current generated dependency baseline
|
|
75
106
|
|
|
76
107
|
| Surface | Pin |
|
|
77
108
|
| ------------------------------ | --------------------------------------------------------------------------------------------------- |
|
|
78
|
-
| Effect runtime and test cohort | `effect`, `@effect/opentelemetry`, and `@effect/vitest`: `4.0.0-rc.
|
|
79
|
-
| Effect compiler | `@effect/tsgo@0.
|
|
80
|
-
| Oxc and Ultracite | `oxlint@1.
|
|
81
|
-
| TanStack Router | `@tanstack/react-router@1.170.
|
|
82
|
-
| Module Federation | `bridge-react`, `manifest`, `modern-js-v3`, and `rspack`: `2.9.
|
|
109
|
+
| Effect runtime and test cohort | `effect`, `@effect/opentelemetry`, and `@effect/vitest`: `4.0.0-rc.117` |
|
|
110
|
+
| Effect compiler | `@effect/tsgo@0.45.0` |
|
|
111
|
+
| Oxc and Ultracite | `oxlint@1.85.0`, `oxfmt@0.70.0`, `ultracite@7.12.0` |
|
|
112
|
+
| TanStack Router | `@tanstack/react-router@1.170.41`, `@tanstack/router-core@1.171.34`, `@tanstack/history@1.162.4` |
|
|
113
|
+
| Module Federation | `bridge-react`, `manifest`, `modern-js-v3`, and `rspack`: `2.9.2`; `@module-federation/node@2.7.52` |
|
|
83
114
|
| Tailwind CSS | `tailwindcss@4.3.3` |
|
|
84
|
-
| Node and package tooling | Node `26.7.0`, `@types/node@^26.
|
|
115
|
+
| Node and package tooling | Node `26.7.0`, `@types/node@^26.6.2`, pnpm `11.27.1` |
|
|
85
116
|
|
|
86
117
|
Generated workspaces default to Module Federation bridge-react's router-free
|
|
87
118
|
base entry (`bridge.enableBridgeRouter: false`), with TanStack Router as the
|
|
@@ -175,11 +206,11 @@ compilers do not share mutable build state.
|
|
|
175
206
|
|
|
176
207
|
## Configure the public preset
|
|
177
208
|
|
|
178
|
-
Use `presetUltramodern(appConfig, presetOptions)` inside the
|
|
209
|
+
Use `presetUltramodern(appConfig, presetOptions)` inside the UltraModern
|
|
179
210
|
`defineConfig` call:
|
|
180
211
|
|
|
181
212
|
```ts title="modern.config.ts"
|
|
182
|
-
import { defineConfig, presetUltramodern } from '@modern-js/app-tools';
|
|
213
|
+
import { defineConfig, presetUltramodern } from '@modern-js/ultramodern-app-tools';
|
|
183
214
|
|
|
184
215
|
export default defineConfig(
|
|
185
216
|
presetUltramodern(
|
package/docs/llms.txt
CHANGED
|
@@ -132,13 +132,14 @@
|
|
|
132
132
|
- [cssLoader](/configure/app/tools/css-loader.md): Type: Object | FunctionDefault: The config of css-loader can be modified through tools.cssLoader.
|
|
133
133
|
- [devServer](/configure/app/tools/dev-server.md): Type: ObjectDefault: {} The config of DevServer can be modified through tools.devServer. Options compress Type: booleanDefault: true Whether to enable gzip compression for served static assets. If you want to disable the gzip compression, you can set compress to false: headers Type: Record<string, string>Default: undefined Adds headers to all responses. historyApiFallback Type: boolean | ConnectHistoryApiFallbackOptionsDefault: false The index.html page will likely have to be served in place of any 404 responses. Enable devServer.historyApiFallback by setting it to true: For more options and information, see the connect-history-api-fallback documentation. proxy Type: ProxyOptions[] | Record<string, string | ProxyOptions>Default: undefined Configure proxy rules for the dev server, and forward requests to the specified service. watch Type: booleanDefault: true Whether to watch files change in directories such as mock/, server/, api/.
|
|
134
134
|
- [htmlPlugin](/configure/app/tools/html-plugin.md): Type: boolean | Object | FunctionDefault: The configs of html-rspack-plugin can be modified through tools.htmlPlugin.
|
|
135
|
-
- [less](/configure/app/tools/less.md): Type: Object | FunctionDefault:
|
|
135
|
+
- [less](/configure/app/tools/less.md): Type: Object | FunctionDefault: tools.less modifies the options of @rsbuild/plugin-less. It accepts the full plugin options: Modifying less-loader options When lessLoaderOptions is an Object, it is merged with the default config through Object.assign in a shallow way. It should be noted that lessOptions is merged through deepMerge in a deep way. For example: When lessLoaderOptions is a Function, the default config is passed as the first parameter, which can be directly modified or returned as the final result. The second parameter provides some utility functions that can be called directly. For example: Parallel compilation Less compilation is pure JavaScript and runs on the Node.js main thread by default. With parallel enabled, Less modules are compiled in a pool of worker threads, which shortens the build when a project has many Less files. Modifying Less Version In some scenarios, if you need to use a specific version of Less instead of the built-in Less v4 in Modern.js, you can install the desired Less version in your project and set it up using the implementation option of the less-loader. Util Function addExcludes Type: (excludes: RegExp | RegExp[]) => void Used to specify which files less-loader does not compile, You can pass in one or more regular expressions to match the path of less files, for example: The plugin's exclude option is the recommended equivalent: Legacy form In earlier versions, tools.less took the less-loader options directly, e.g. tools.less: { lessOptions: {} } or tools.less(config, { addExcludes }) {}. This form still works: Modern.js wraps it into lessLoaderOptions and produces exactly the same config as before. A migration hint is printed in development, and the legacy form will be removed in the next major version.
|
|
136
136
|
- [lightningcssLoader](/configure/app/tools/lightningcss-loader.md): Type: Rspack.LightningcssLoaderOptions | Function | booleanDefault: Rspack.LightningcssLoaderOptions | Function | boolean You can configure builtin:lightningcss-loader through tools.lightningcssLoader.
|
|
137
137
|
- [minifyCss](/configure/app/tools/minify-css.md): Type: Object | Function | undefinedDefault: When building for production, Modern.js will minimize the CSS code through css-minimizer-webpack-plugin. The config of css-minimizer-webpack-plugin can be modified via tools.minifyCss. Object Type When tools.minifyCss is Object type, it will be merged with the default config via Object.assign. For example, modify the preset config of cssnano: Function Type When tools.minifyCss is Function type, the default config is passed in as the first parameter, the config object can be modified directly, or a value can be returned as the final result.
|
|
138
138
|
- [postcss](/configure/app/tools/postcss.md): Type: Object | FunctionDefault: Modern.js integrates PostCSS by default, you can configure postcss-loader through tools.postcss. It should be noted that when you enable the tools.lightningcss configuration, PostCSS will be disabled by default, including postcss-loader and its default plugins.
|
|
139
139
|
- [rspack](/configure/app/tools/rspack.md): Type: Rspack.Configuration | Function | undefinedDefault: undefined tools.rspack is used to configure Rspack.
|
|
140
|
-
- [sass](/configure/app/tools/sass.md): Type: Object | FunctionDefault:
|
|
140
|
+
- [sass](/configure/app/tools/sass.md): Type: Object | FunctionDefault: tools.sass modifies the options of @rsbuild/plugin-sass. It accepts the full plugin options: Modifying sass-loader options When sassLoaderOptions is an Object, it is merged with the default config through Object.assign in a shallow way. It should be noted that sassOptions is merged through deepMerge in a deep way. For example: When sassLoaderOptions is a Function, the default config is passed as the first parameter, which can be directly modified or returned as the final result. The second parameter provides some utility functions that can be called directly. For example: Disabling URL rewriting By default, relative URLs in Sass files are rewritten by resolve-url-loader so that they resolve relative to the source file. If your project does not rely on this, turn it off to drop one loader from the chain: Modifying Sass Version In some scenarios, if you need to use a specific version of Sass instead of the built-in Dart Sass v1 in Modern.js, you can install the desired Sass version in your project and set it up using the implementation option of the sass-loader. Util Function addExcludes Type: (excludes: RegExp | RegExp[]) => void Used to specify which files sass-loader does not compile, You can pass in one or more regular expressions to match the path of sass files, for example: The plugin's exclude option is the recommended equivalent: Legacy form In earlier versions, tools.sass took the sass-loader options directly, e.g. tools.sass: { sassOptions: {} } or tools.sass(config, { addExcludes }) {}. This form still works: Modern.js wraps it into sassLoaderOptions and produces exactly the same config as before. A migration hint is printed in development, and the legacy form will be removed in the next major version.
|
|
141
141
|
- [styleLoader](/configure/app/tools/style-loader.md): Type: Object | FunctionDefault: {} The config of style-loader can be set through tools.styleLoader.
|
|
142
|
+
- [svgr](/configure/app/tools/svgr.md): Type: Object | Function | falseDefault: tools.svgr modifies the options of @rsbuild/plugin-svgr. It accepts the full plugin options. Set it to false to skip registering the SVGR plugin; all .svg files are then treated as static assets. Merge rules When tools.svgr is an Object, its top-level fields are merged with the defaults through Object.assign in a shallow way, and svgrOptions is merged one level deeper, so setting only svgrOptions.icon keeps the default exportType. When tools.svgr is a Function, the default config is passed as the first parameter, which can be directly modified or returned as the final result. An array of objects and functions is also accepted and applied in order. Parallel transform The SVGR transform is pure JavaScript and runs on the Node.js main thread by default. With many SVG files, enable parallel to move the transform into a pool of worker threads: Changing the default export svgrOptions.exportType controls what an SVG file exports by default: 'named' exports the file URL by default and the React component as the named export ReactComponent; 'default' exports the React component by default. Disabling SVGR If you are sure that no SVG asset in your project is used as a React component, disable SVGR to improve build performance: Relation to the legacy options tools.svgr replaces the two deprecated options below. They still work today and will be removed in the next major version: When both are set, tools.svgr wins: once tools.svgr is set explicitly, output.disableSvgr no longer applies, and tools.svgr.svgrOptions.exportType overrides the value derived from output.svgDefaultExport.
|
|
142
143
|
- [swc](/configure/app/tools/swc.md): Type: Object | FunctionDefault: undefined
|
|
143
144
|
- [tsChecker](/configure/app/tools/ts-checker.md): Type: Object | FunctionDefault: By default, the @rsbuild/plugin-type-check is enabled for type checking. You can use output.disableTsChecker config to disable it.
|
|
144
145
|
- [aliasStrategy](/configure/app/source/alias-strategy.md): Type: 'prefer-tsconfig' | 'prefer-alias'Default: 'prefer-tsconfig' source.aliasStrategy is used to control the priority between the paths option in tsconfig.json and the alias option in the bundler.
|
|
@@ -156,7 +157,7 @@
|
|
|
156
157
|
- [include](/configure/app/source/include.md): Type: RuleSetCondition[]Default value: source.include is used to specify additional JavaScript files that need to be compiled. By default, the following files will be compiled: TypeScript and JSX files in any directory, with file extensions matching .ts, .tsx, .jsx, .mts, .cts.JavaScript files not in the node_modules directory, with file extensions matching .js, .mjs, .cjs.
|
|
157
158
|
- [mainEntryName](/configure/app/source/main-entry-name.md): Type: stringDefault: 'index' This option is used to configure the main entry name of Modern.js. By default, the default main entry name of Modern.js is index. When using a single entry or the entry name is the same as the name field in package.json, the corresponding entry will be used as the main entry. This configuration can be used to modify the name of the main entry. For example, change the main entry name to main: After building, the corresponding HTML output path will be changed to dist/html/index/index.html.
|
|
158
159
|
- [preEntry](/configure/app/source/pre-entry.md): Type: string | string[]Default: [] 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.
|
|
159
|
-
- [reactCompiler](/configure/app/source/react-compiler.md): Type: boolean | ReactCompilerOptionsDefault: undefined (disabled) Whether to enable React Compiler. React Compiler is a build-time tool that optimizes re-rendering performance of React applications through automatic memoization. Modern.js implements this capability based on the Rust-based React Compiler built into Rspack's builtin:swc-loader (equivalent to setting SWC's jsc.transform.reactCompiler), reusing Rspack's built-in SWC transform chain without introducing Babel.
|
|
160
|
+
- [reactCompiler](/configure/app/source/react-compiler.md): Type: boolean | ReactCompilerOptionsDefault: undefined (disabled) Whether to enable React Compiler. React Compiler is a build-time tool that optimizes re-rendering performance of React applications through automatic memoization. Modern.js implements this capability based on the Rust-based React Compiler built into Rspack's builtin:swc-loader (equivalent to setting SWC's jsc.transform.reactCompiler), reusing Rspack's built-in SWC transform chain without introducing Babel. The compiler only runs for browser environments (output.target: 'web'). Server environments (node, the web-worker SSR worker and BFF code) render once per request and gain nothing from memoization, so they are never compiled.
|
|
160
161
|
- [transformImport](/configure/app/source/transform-import.md): Transform the import path, which can be used to modularly import the subpath of third-party packages. The functionality is similar to babel-plugin-import。 Type: Default: undefined
|
|
161
162
|
- [aliasStrategy](/configure/app/resolve/alias-strategy.md): Type: 'prefer-tsconfig' | 'prefer-alias'Default: 'prefer-tsconfig' Set the strategy for path alias resolution, to control the priority relationship between the paths option in tsconfig.json and the resolve.alias option of Rsbuild.
|
|
162
163
|
- [alias](/configure/app/resolve/alias.md): Type: string[] Create aliases for module paths to simplify import paths or redirect module references.
|
|
@@ -128,16 +128,16 @@ You can read [Rsbuild Official Website - Plugins](https://v2.rsbuild.rs/plugins/
|
|
|
128
128
|
|
|
129
129
|
The following are official Rsbuild plugins that are already built into Modern.js. They can be enabled without installation:
|
|
130
130
|
|
|
131
|
-
| Plugin | Description | Modern.js Link
|
|
132
|
-
| -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
133
|
-
| [React Plugin](https://v2.rsbuild.rs/plugins/list/plugin-react) | Provides support for React | -
|
|
134
|
-
| [SVGR Plugin](https://v2.rsbuild.rs/plugins/list/plugin-svgr) | Supports converting SVG images into React components | [
|
|
135
|
-
| [Assets Retry Plugin](https://github.com/rstackjs/rsbuild-plugin-assets-retry) | Automatically retries requests when static asset loading fails | [output.assetsRetry](/configure/app/output/assets-retry.md)
|
|
136
|
-
| [Type Check Plugin](https://github.com/rstackjs/rsbuild-plugin-type-check) | Runs TypeScript type checking in a separate process | [output.disableTsChecker](/configure/app/output/disable-ts-checker.md)<br />[tools.tsChecker](/configure/app/tools/ts-checker.md)
|
|
137
|
-
| [Source Build Plugin](https://github.com/rstackjs/rsbuild-plugin-source-build) | For monorepo scenarios, supports referencing source code from other subdirectories and completing builds and hot updates | [experiments.sourceBuild](/configure/app/experiments/source-build.md)
|
|
138
|
-
| [Check Syntax Plugin](https://github.com/rstackjs/rsbuild-plugin-check-syntax) | Analyzes the syntax compatibility of the build artifacts to determine if there are any advanced syntax features that cause compatibility issues | [security.checkSyntax](/configure/app/security/check-syntax.md)
|
|
139
|
-
| [CSS Minimizer Plugin](https://github.com/rstackjs/rsbuild-plugin-css-minimizer) | Used to customize the CSS compression tool, switch to [cssnano](https://cssnano.co/) or other tools for CSS compression | [tools.minifyCss](/configure/app/tools/minify-css.md)
|
|
140
|
-
| [Rem Plugin](https://github.com/rstackjs/rsbuild-plugin-rem) | Implements rem adaptive layout for mobile pages | [output.convertToRem](/configure/app/output/convert-to-rem.md)
|
|
131
|
+
| Plugin | Description | Modern.js Link |
|
|
132
|
+
| -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
133
|
+
| [React Plugin](https://v2.rsbuild.rs/plugins/list/plugin-react) | Provides support for React | - |
|
|
134
|
+
| [SVGR Plugin](https://v2.rsbuild.rs/plugins/list/plugin-svgr) | Supports converting SVG images into React components | [tools.svgr](/configure/app/tools/svgr.md) |
|
|
135
|
+
| [Assets Retry Plugin](https://github.com/rstackjs/rsbuild-plugin-assets-retry) | Automatically retries requests when static asset loading fails | [output.assetsRetry](/configure/app/output/assets-retry.md) |
|
|
136
|
+
| [Type Check Plugin](https://github.com/rstackjs/rsbuild-plugin-type-check) | Runs TypeScript type checking in a separate process | [output.disableTsChecker](/configure/app/output/disable-ts-checker.md)<br />[tools.tsChecker](/configure/app/tools/ts-checker.md) |
|
|
137
|
+
| [Source Build Plugin](https://github.com/rstackjs/rsbuild-plugin-source-build) | For monorepo scenarios, supports referencing source code from other subdirectories and completing builds and hot updates | [experiments.sourceBuild](/configure/app/experiments/source-build.md) |
|
|
138
|
+
| [Check Syntax Plugin](https://github.com/rstackjs/rsbuild-plugin-check-syntax) | Analyzes the syntax compatibility of the build artifacts to determine if there are any advanced syntax features that cause compatibility issues | [security.checkSyntax](/configure/app/security/check-syntax.md) |
|
|
139
|
+
| [CSS Minimizer Plugin](https://github.com/rstackjs/rsbuild-plugin-css-minimizer) | Used to customize the CSS compression tool, switch to [cssnano](https://cssnano.co/) or other tools for CSS compression | [tools.minifyCss](/configure/app/tools/minify-css.md) |
|
|
140
|
+
| [Rem Plugin](https://github.com/rstackjs/rsbuild-plugin-rem) | Implements rem adaptive layout for mobile pages | [output.convertToRem](/configure/app/output/convert-to-rem.md) |
|
|
141
141
|
|
|
142
142
|
#### Plugins Not Built-in
|
|
143
143
|
|
|
@@ -191,6 +191,7 @@ Adds additional logic when the server resets.
|
|
|
191
191
|
- `'file-change'`: File change event
|
|
192
192
|
- `event.payload`: When `type` is `'file-change'`, contains an array of file change information.
|
|
193
193
|
- **Execution Phase:** When files change or repack is needed.
|
|
194
|
+
- **Repack Order:** On `'repack'` the dev server awaits the handlers in registration order before it purges the previous server bundle from the require cache. A rejecting handler skips the handlers after it. New requests wait until the handlers settle; requests already running keep the modules they loaded. A repack handler must not await a request to the dev server, because that request waits for the handler.
|
|
194
195
|
- **Example:**
|
|
195
196
|
|
|
196
197
|
```typescript
|