website/docs/scope.md
ts-node transforms certain files and ignores others. We refer to this mechanism as "scoping." There are various options to configure scoping, so that ts-node transforms only the files in your project.
Warning:
An ignored file can still be executed by node.js. Ignoring a file means we do not transform it from TypeScript into JavaScript, but it does not prevent execution.
If a file requires transformation but is ignored, node may either fail to resolve it or attempt to execute it as vanilla JavaScript. This may cause syntax errors or other failures, because node does not understand TypeScript type syntax nor bleeding-edge ECMAScript features.
.js and .jsx are only transformed when allowJs is enabled.
.tsx and .jsx are only transformed when jsx is enabled.
Warning:
When ts-node is used with
allowJs, all non-ignored JavaScript files are transformed by ts-node.
node_modulesBy default, ts-node avoids compiling files in /node_modules/ for three reasons:
If you need to import uncompiled TypeScript in node_modules, use --skipIgnore or TS_NODE_SKIP_IGNORE to bypass this restriction.
If a compiled JavaScript file with the same name as a TypeScript file already exists, the TypeScript file will be ignored. ts-node will import the pre-compiled JavaScript.
To force ts-node to import the TypeScript source, not the precompiled JavaScript, use --preferTsExts.
Our scope and scopeDir options will limit transformation to files
within a directory.
Our ignore option will ignore files matching one or more regular expressions.