diff --git a/website/docs/how-it-works.md b/website/docs/how-it-works.md index 923c0592c..f75f32c3f 100644 --- a/website/docs/how-it-works.md +++ b/website/docs/how-it-works.md @@ -16,9 +16,16 @@ Vanilla `node` loads `.js` by reading code from disk and executing it. Our hook ## Skipping `node_modules` -By default, **TypeScript Node** avoids compiling files in `/node_modules/` for three reasons: +By default, ts-node avoids compiling files in `/node_modules/` for three reasons: 1. Modules should always be published in a format node.js can consume 2. Transpiling the entire dependency tree will make your project slower 3. Differing behaviours between TypeScript and node.js (e.g. ES2015 modules) can result in a project that works until you decide to support a feature natively from node.js +If you need to import uncompiled TypeScript in `node_modules`, use [`--skipIgnore`](./options#transpilation) or [`TS_NODE_SKIP_IGNORE`](./options#transpilation) to bypass this restriction. + +## Skipping pre-compiled TypeScript + +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`](./options#transpilation).