I'm converting a legacy node/express codebase to TypeScript, following the Microsoft TypeScript starter as a starting reference.
In this reference output is compiled to dist
, however when enabling allowJS
in tsconfig.json
, the output is emitted to dist/src
- why is that?
Here is my tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"moduleResolution": "node",
"sourceMap": true,
"rootDir" : "./",
"outDir": "dist",
"baseUrl": ".",
"allowJs": true,
"paths": {
"*": [
"node_modules/*",
"src/types/*"
]
}
},
"include": [
"src/**/*"
]
}
- I tried changing
rootDir
to./src
but it gives an error saying 'node_modules/someModule' is not in the src root. - I tried moving
tsconfig.json
to src, according to a GitHub issue I saw, but no output was generated.
AllowJS
The output was mapping correctly under /dist
until allowJS
flag was turned on in tsconfig.json
, after which output appeared in /dist/src