@modern-js/main-doc 2.68.10 → 2.68.12

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.
@@ -27,6 +27,10 @@ Lazy compilation only takes effect in the development.
27
27
 
28
28
  ## Rspack
29
29
 
30
+ In Rsbuild, Lazy Compilation is enabled by default. But in Modern.js, some features of Modern.js may conflict with Lazy Compilation, so we disabled it by default.
31
+
32
+ If your project uses SSR or [Prefetch Link](/guides/basic-features/routes.html#prefetching), we recommended you to disable Lazy Compilation.
33
+
30
34
  import RsbuildLink from '@site/src/components/RsbuildLink';
31
35
 
32
36
  :::info
@@ -8,7 +8,7 @@ Modern.js encapsulates most server-side capabilities required by projects, typic
8
8
 
9
9
  ## Starting a Custom Web Server
10
10
 
11
- :::info
11
+ :::tip
12
12
  You must ensure that the Modern.js version is x.67.5 or above.
13
13
  :::
14
14
 
@@ -24,6 +24,8 @@ After executing the command, a `server/modern.server.ts` file will be automatica
24
24
 
25
25
  ## Capabilities of the Custom Web Server
26
26
 
27
+ Modern.js's Web Server is based on Hono, and in the latest version of the Custom Web Server, we expose Hono's middleware capabilities, you can refer to [Hono API](https://hono.dev/docs/api/context) for more usage.
28
+
27
29
  In the `server/modern.server.ts` file, you can add the following configurations to extend the Server:
28
30
  - **Middleware**
29
31
  - **Render Middleware**
@@ -27,6 +27,10 @@ type LazyCompilationOptions =
27
27
 
28
28
  ## Rspack
29
29
 
30
+ 在 Rsbuild 中,Lazy Compilation 默认是开启的。但在 Modern.js 中,部分功能特性存在冲突,因此默认是关闭的。
31
+
32
+ 如果项目中使用 SSR 或是[预加载路由](/guides/basic-features/routes.html#预加载)时,请不要开启 Lazy Compilation。
33
+
30
34
  import RsbuildLink from '@site/src/components/RsbuildLink';
31
35
 
32
36
  :::info
@@ -6,9 +6,10 @@ sidebar_position: 16
6
6
 
7
7
  Modern.js 将大部分项目需要的服务端能力都进行了封装,通常项目无需进行服务端开发。但在有些开发场景下,例如用户鉴权、请求预处理、添加页面渲染骨架等,项目仍需要对服务端进行定制。
8
8
 
9
+
9
10
  ## 开启自定义 Web Server
10
11
 
11
- :::info
12
+ :::tip
12
13
  必须确保 Modern.js 版本是 x.67.5 及以上。
13
14
  :::
14
15
 
@@ -24,6 +25,8 @@ Modern.js 将大部分项目需要的服务端能力都进行了封装,通常
24
25
 
25
26
  ## 自定义 Web Server 能力
26
27
 
28
+ Modern.js 的服务器基于 Hono 实现,在最新版本的自定义 Web Server 中,我们向用户暴露了 Hono 的中间件能力,你可以参考 [Hono 文档](https://hono.dev/docs/api/context) 了解更多用法。
29
+
27
30
  `server/modern.server.ts` 文件中添加如下配置来扩展 Server:
28
31
  - **中间件(Middleware)**
29
32
  - **渲染中间件(RenderMiddleware)**
@@ -69,7 +72,6 @@ type ServerConfig = {
69
72
  }
70
73
  ```
71
74
 
72
-
73
75
  ### Middleware
74
76
 
75
77
  Middleware 支持在 Modern.js 服务的**请求处理**与**页面路由**的流程前后,执行自定义逻辑。
package/package.json CHANGED
@@ -15,17 +15,17 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.68.10",
18
+ "version": "2.68.12",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
24
  "mermaid": "^11.4.1",
25
- "@modern-js/sandpack-react": "2.68.10"
25
+ "@modern-js/sandpack-react": "2.68.12"
26
26
  },
27
27
  "devDependencies": {
28
- "@rsbuild/plugin-sass": "1.3.5",
28
+ "@rsbuild/plugin-sass": "1.4.0",
29
29
  "@shikijs/transformers": "^3.4.2",
30
30
  "@rspress/shared": "2.0.0-beta.16",
31
31
  "@rspress/plugin-llms": "2.0.0-beta.16",