How to avoid "Emit skipped" error #1595
Short summary of the root cause:"Emit skipped" error is thrown because a config file is written as I am using commitlint which is using ts-node as a dep. Now somehow whenever I try to commit Search TermsEmit Skipped Actual BehaviorEdit: just found that even after settings the Expected Behaviorshould not throw compile error and emit skipped. Steps to reproduce the problemMinimal reproductionhttps://github.com/iamarpitpatidar/ts-node-bug Specifications
|
Replies: 3 comments 4 replies
|
I see you have a config file written in |
|
yeah, that's the thing the github I linked has the exact same config with just one file that I am using.. but wierd that it throws error,. about @cspotcode do you think there is a way to fix this ? |
|
ts-node uses typescript under the hood. We need to get output JS to give to node to execute it. TypeScript does not emit files that fall outside your rootDir. So when ts-node is asked for the JS code from a file, and typescript doesn't give it to us, you get the error.
Or you can use https://typestrong.org/ts-node/docs/configuration |
ts-node uses typescript under the hood. We need to get output JS to give to node to execute it. TypeScript does not emit files that fall outside your rootDir. So when ts-node is asked for the JS code from a file, and typescript doesn't give it to us, you get the error.
transpileOnlymode avoids this because we avoid typechecking complexity and use a simpler method of transformation. Each file is transformed in isolation. TypeScript doesn't care where the input file is located, and it always emits JS.Or you can use
compilerOptionsoverrides to modify yourrootDironly when ts-node is running.https://typestrong.org/ts-node/docs/configuration
https://typestrong.org/ts-node/docs/options