官术网_书友最值得收藏!

Referencing projects 

The first step in setting up TypeScript 3's multiple projects feature is to reference projects using a new field called references in tsconfig.json. This field is an array of objects that specify projects to reference.

In our working example, let's make ProjectA start to understand the Shared project:

  1. Let's change the tsconfig.json in ProjectA to reference the Shared project:
{
"compilerOptions": {
...
},
"references": [
{ "path": "../shared" }
]
}
If we want the dependent project's generated JavaScript code to be included in the same file as the current project, we can set   prepend to   true on the dependency .
"references": [
{ "path": "../shared", "prepend": true }
]

  We're not going to use prepend in our example though.

  1. If we compile ProjectA again, a different error is raised:
error TS6306: Referenced project '.../shared' must have setting "composite": true

The error gives a great clue as to what is wrong. We'll resolve this problem with the missing composite setting in the next section.

主站蜘蛛池模板: 丰原市| 民权县| 岑巩县| 堆龙德庆县| 扶风县| 英山县| 财经| 庐江县| 清水县| 德令哈市| 阿拉善左旗| 崇左市| 新晃| 甘孜| 龙胜| 临高县| 中山市| 德格县| 泽库县| 桐庐县| 桐庐县| 科尔| 凤城市| 浮山县| 沙湾县| 英山县| 本溪市| 延川县| 本溪| 永顺县| 福鼎市| 平阳县| 永胜县| 淮北市| 光山县| 康保县| 云安县| 客服| 夹江县| 静乐县| 崇仁县|