I have a src
directory with my source code and unit tests, and a test
directory containing a separate speed test.
When I build my project with tsc
, I get a directory structure like this:
dist/
src/
index.js
...
test/
speed-test.js
I'd prefer, however, to get "flat" output to my dist
directory, like this:
dist/
index.js
...
speed-test.js
...
If I delete speed-test.ts
from the test
directory, tsc
doesn't add a src
directory to dist
. The extra directory structure only gets added when there's a need (or at least, when tsc
decides there's a need) to distiguish the sources of the compiled code.
I'm sure that's very useful at times to avoid file name conflicts, but that's not important for me in this case, and I'd prefer not to get this extra "help".
Here's my tsconfig.json
:
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs",
"outDir": "./dist",
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noImplicitReturns": true,
"moduleResolution": "node",
"esModuleInterop": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true
}
}
I tried adding a "rootDirs"
options of ["src", "test"]
, but that didn't help.
Is there anyway for me to get the output structure I'm looking for?