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

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.

主站蜘蛛池模板: 明水县| 乌鲁木齐市| 二手房| 香港| 称多县| 沽源县| 清苑县| 辛集市| 平利县| 博罗县| 乌拉特后旗| 金山区| 大荔县| 南江县| 万年县| 乌拉特中旗| 交口县| 库车县| 云林县| 大石桥市| 前郭尔| 桦川县| 蕲春县| 维西| 油尖旺区| 肥西县| 建水县| 玉龙| 鞍山市| 英山县| 鄂州市| 广南县| 临漳县| 安宁市| 南华县| 莒南县| 中牟县| 太和县| 兴城市| 拜城县| 郧西县|