@modern-js/main-doc 0.0.0-nightly-20241101090401 → 0.0.0-nightly-20241102170633

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.
@@ -124,13 +124,10 @@ Project reference provides the following capabilities:
124
124
 
125
125
  ### Example
126
126
 
127
- In the example mentioned earlier, since the app project references the lib sub-project, we need to configure the `composite` and `references` options in the app project's `tsconfig.json` file and point them to the corresponding relative directory of lib:
127
+ In the example mentioned earlier, since the app project references the lib sub-project, we need to configure the `references` options in the app project's `tsconfig.json` to point to the relative directory of the lib:
128
128
 
129
129
  ```json title="app/tsconfig.json"
130
130
  {
131
- "compilerOptions": {
132
- "composite": true
133
- },
134
131
  "references": [
135
132
  {
136
133
  "path": "../lib"
@@ -139,6 +136,16 @@ In the example mentioned earlier, since the app project references the lib sub-p
139
136
  }
140
137
  ```
141
138
 
139
+ At the same time, we need to set `composite` to `true` in the lib project's `tsconfig.json`:
140
+
141
+ ```json title="lib/A/tsconfig.json"
142
+ {
143
+ "compilerOptions": {
144
+ "composite": true
145
+ },
146
+ }
147
+ ```
148
+
142
149
  After adding these two options, the project reference is already configured. You can restart VS Code to see the effects of the configuration.
143
150
 
144
151
  Note that the above example is a simplified one. In real monorepo projects, there may be more complex dependency relationships. You need to add a complete `references` configuration for the functionality to work correctly.
@@ -124,13 +124,10 @@ Project reference 提供了以下能力:
124
124
 
125
125
  ### 示例
126
126
 
127
- 在上文的例子中,由于 app 引用了 lib 子项目,我们需要在 app 的 `tsconfig.json` 内配置 `composite` 和 `references`,并指向 lib 对应的相对目录:
127
+ 在上文的例子中,由于 app 引用了 lib 子项目,我们需要在 app 的 `tsconfig.json` 内配置 `references`,并指向 lib 对应的相对目录:
128
128
 
129
129
  ```json title="app/tsconfig.json"
130
130
  {
131
- "compilerOptions": {
132
- "composite": true
133
- },
134
131
  "references": [
135
132
  {
136
133
  "path": "../lib"
@@ -139,6 +136,16 @@ Project reference 提供了以下能力:
139
136
  }
140
137
  ```
141
138
 
139
+ 同时,需要在 lib 子项目的 `tsconfig.json` 内配置 `composite` 为 `true`:
140
+
141
+ ```json title="lib/A/tsconfig.json"
142
+ {
143
+ "compilerOptions": {
144
+ "composite": true
145
+ },
146
+ }
147
+ ```
148
+
142
149
  添加以上两个选项后,project reference 就已经配置完成了,你可以重新启动 VS Code 来查看配置以后的效果。
143
150
 
144
151
  注意以上只是一个最简单的例子,在实际的 monorepo 项目中,可能会有更复杂的依赖关系,你需要添加完整的 `references` 配置,才能使上述功能正确运作。
package/package.json CHANGED
@@ -15,14 +15,14 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-nightly-20241101090401",
18
+ "version": "0.0.0-nightly-20241102170633",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public",
22
22
  "provenance": true
23
23
  },
24
24
  "dependencies": {
25
- "@modern-js/sandpack-react": "0.0.0-nightly-20241101090401"
25
+ "@modern-js/sandpack-react": "0.0.0-nightly-20241102170633"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@rspress/shared": "1.35.2",