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

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.

主站蜘蛛池模板: 贺兰县| 如东县| 嘉鱼县| 昌邑市| 洛阳市| 梅河口市| 静乐县| 长武县| 濮阳县| 永寿县| 宜川县| 灵璧县| 宜宾市| 阿克| 新建县| 徐闻县| 成安县| 陕西省| 于田县| 正阳县| 武汉市| 通许县| 莱州市| 商水县| 万山特区| 米泉市| 特克斯县| 西青区| 方山县| 临漳县| 营山县| 东山县| 开封县| 兴业县| 高要市| 玉环县| 从化市| 昌邑市| 富平县| 和政县| 永善县|