Stef Stef - 1 year ago 87
TypeScript Question

How to build to output folder when the typescript files are located in './src'

What I have:


And tsc should create a javascript (
) and definition file (
) in the

My tsconfig.ts:

"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"rootDir": ".",
"outDir": "./build",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"declaration": true
"files": [
"exclude": [
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false

But this config file generates the
in the

Note that I cannot use
"rootDir": "./src"
because then the test folder is not compiled (which gives problems when running tests with karma + webpack?)

Answer Source

And tsc should create a javascript (myfile.js) and definition file (myfile.d.ts) in the ./build location.

TypeScript is not nicely modeled to handle bundling. That is something you should use some other tool to do


e.g. Webpack quickstart:

Don't recommend out / outFile :

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download