I have multiple typescript projects (e.g. client
and server
), which share some common functionality (located in a common
fold
And now we have the support for project references in Typescript 3.0 (i.e. cascade build of multiple Typescript projects). We can also control the output location of the tsc
builds.
https://blogs.msdn.microsoft.com/typescript/2018/07/30/announcing-typescript-3-0/#project-references
If a Typescript project 'bar' uses project 'foo', here is how you chain them:
// ./src/bar/tsconfig.json
{
"compilerOptions": {
// Needed for project references.
"composite": true,
"declaration": true,
// Other options...
"outDir": "../../lib/bar",
"strict": true, "module": "esnext", "moduleResolution": "node",
},
"references": [
{ "path": "../foo" }
]
}
Thanks, TS guys!