I am in the process of planning a monorepo TypeScript project structured as follows:
/ (root)
+--backend/
| +-src/
| \-tsconfig.json
+--shared/
| \-src/
\--frontend/
\-src/
The tsconfig.json
file looks like this:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"outDir": "./dist",
"strict": true,
"baseUrl": "./src",
"paths": {
"shared": [
"../../shared/src"
]
},
"rootDirs": [
"./src",
"../shared/src"
],
"esModuleInterop": true
}
}
Upon running tsc
within the backend
directory, the output structure is currently:
/ (root)
+-backend/
+-dist/
| +-backend/
| | +-src/
| \-shared/
| \-src/
+-src/
\-tsconfig.json
In this output, both dist/backend
and dist/shared
directories contain an additional src
subdirectory. However, I would like them to only have the compiled JavaScript files without the src
directory:
/ (root)
+-backend/
+-dist/
| +-backend/
| \-shared/
+-src/
\-tsconfig.json
Is this achievable? If so, how can I achieve it?