I have put noEmit: true in my tsconfig.json to prevent tsc from outputting .js files next to my .ts files. Otherwise, I get these files scattered across my project whenever I run my tests, or save a file in my IDE. Since I'm using webpack to bundle my files, I simply don't want tsc to emit files.
However, this setting breaks ts-loader since it doesn't receive any output. I think it would be very nice if we could default noEmit to be false, even if it's specified as true in tsconfig.json.
Compiling my files
ERROR in ./app.ts
Module build failed: Error: Typescript emitted no output for .../app.ts.
at successLoader (.../node_modules/ts-loader/dist/index.js:47:15)
at Object.loader (.../node_modules/ts-loader/dist/index.js:29:12)
1) Create a tsconfig.json file with { "compilerOptions": { "noEmit": true } }
2) Create a app.ts with some TypeScript code
3) Try to bundle the file with ts-loader
Hi @LinusU
We're unlikely to take this change as we intentionally want ts-loader behaviour to be as similar to tsc as is sensible. Reasons: we want moving to using ts-loader and moving away from using ts-loader to be an uncomplicated experience. It sounds like your setup is somewhat custom though. Personally I use ts-loader for my tests as well as the app. I'd suggest that's the standard approach people use. Do check out our examples of you'd like to do the same.
Thanks for the clear request - closing as we are unlikely to implement.
It sounds like your setup is somewhat custom though.
I would like to know how other people have this setup though 馃
It seems like Atom with the TypeScript plugin installed by default runs tsc when you save a file, and I believe that ts-lint also runs tsc.
I had to add noEmit: true since my colleague's computer started creating a lot of .js files 馃
It seems like Atom with the TypeScript plugin installed by default runs tsc when you save a file
This may be true - I think you can set a compileOnSave property in your tsconfig.json which will disable this
Hmm, yeah that's probably it! Thanks.
My next problem is that in some projects I run tsc simply to validate all of the source code without building it. I guess that could be solved by adding --noEmit to the call though.
Still, would really prefer if this was the default for this lib, since it can't function without it...
Most helpful comment
Hmm, yeah that's probably it! Thanks.
My next problem is that in some projects I run
tscsimply to validate all of the source code without building it. I guess that could be solved by adding--noEmitto the call though.Still, would really prefer if this was the default for this lib, since it can't function without it...