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

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.

主站蜘蛛池模板: 阿坝| 九江县| 荥阳市| 西畴县| 贵德县| 莫力| 密云县| 双鸭山市| 商南县| 资中县| 河津市| 江都市| 洛扎县| 石屏县| 防城港市| 和硕县| 布尔津县| 诸城市| 芮城县| 武城县| 哈巴河县| 滁州市| 海原县| 富裕县| 老河口市| 武胜县| 繁峙县| 吴江市| 屏山县| 永靖县| 辽中县| 咸宁市| 芒康县| 呼伦贝尔市| 扶风县| 离岛区| 桑日县| 蒲江县| 武山县| 汾西县| 盱眙县|