I have a TypeScript nodejs server with this structure:
tsconfig.json
package.json
src/
middleware/
utils/
index.ts
dist/
middleware/
utils/
index.js
When using TypeScript 2, I was able to transpile my project from the src/ to a dist/ folder and have a mirror image of my directory structure to work with.
With the release of TypeScript 3, they have introduced project references and changed the way code is transpiled into an output directory. Now tsc
outputs to the dist/ folder in a nested way like this:
dist/
src/
middleware/
utils/
index.js
My tsconfig.json is:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"allowJs": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"declaration": false,
"outDir": "dist/",
"lib": [
"es7",
"dom"
]
},
"include": [
"src/"
]
}
How can I configure TypeScript to output my src/ folder as a mirror image into a dist/ folder?
resolveJsonModule
maketsc
output to/dist/src
instead of/dist
? It doesn't make any sense. – Tachymetry