Skip to content

How to avoid "Emit skipped" error #1595

Answered by cspotcode
iamarpitpatidar asked this question in Q&A
Discussion options

You must be logged in to vote

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.

transpileOnly mode 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 compilerOptions overrides to modify your rootDir only when ts-node is running.

https://typestrong.org/ts-node/docs/configuration
https://typestrong.org/ts-node/docs/options

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@cspotcode
Comment options

@iamarpitpatidar
Comment options

@cspotcode
Comment options

@iamarpitpatidar
Comment options

Answer selected by cspotcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1593 on January 11, 2022 22:37.