Here is what I currently have:
./src/myfile.ts
./test/mytest.spec.ts
I want tsc to output a javascript file (myfile.js
) and a definition file (myfile.d.ts
) in the ./build
directory.
This is my tsconfig.ts:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"rootDir": ".",
"outDir": "./build",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"declaration": true
},
"files": [
"./src/index.ts"
],
"exclude": [
".vscode",
".git",
"build",
"node_modules",
"test"
],
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
The issue is that this configuration generates the myfile.js
in the sub-folder ./build/src/
.
Please note that setting "rootDir": "./src"
causes the test folder not to be compiled, resulting in problems when running tests with karma + webpack.