![]() -scope Scope compiler to files within cwd ( TS_NODE_SCOPE, default: false).-dir Specify working directory for config resolution ( TS_NODE_CWD, default: process.cwd(), or dirname(scriptPath) if -script-mode).-O, -compiler-options JSON object to merge with compiler options ( TS_NODE_COMPILER_OPTIONS).-D, -ignore-diagnostics Ignore TypeScript warnings by diagnostic code ( TS_NODE_IGNORE_DIAGNOSTICS). ![]() -C, -compiler Specify a custom TypeScript compiler ( TS_NODE_COMPILER, default: typescript).-P, -project Path to TypeScript JSON project file ( TS_NODE_PROJECT).-I, -ignore Override the path patterns to skip compilation ( TS_NODE_IGNORE, default: /node_modules/).-H, -compiler-host Use TypeScript's compiler host API ( TS_NODE_COMPILER_HOST, default: false).-T, -transpile-only Use TypeScript's faster transpileModule ( TS_NODE_TRANSPILE_ONLY, default: false).The name of the environment variable and the option's default value are denoted in parentheses. -s, -script-mode Resolve config relative to the directory of the passed script instead of the current directory.vv prints node and typescript compiler versions, too Ts-node supports -print ( -p), -eval ( -e), -require ( -r) and -interactive ( -i) similar to the node.js CLI options. Note: ntypescript is an example of a TypeScript-compatible compiler. Ts-node -compiler ntypescript -project src/tsconfig.json hello-world.ts You can set options by passing them before the script path, via programmatic usage, via tsconfig.json, or via environment variables. Tip: You can use ts-node together with tsconfig-paths to load modules according to the paths section in tsconfig.json. Use -project to specify the path to your tsconfig.json, ignoring -dir. Otherwise it is resolved relative to process.cwd(), which matches the behavior of tsc. In -script-mode, this is the directory containing the script. It is resolved relative to -dir using the same search behavior as tsc. Use -skip-project to skip loading the tsconfig.json. Typescript Node loads tsconfig.json automatically. When ts-node is used with allowJs, JavaScript files are transpiled using the TypeScript compiler. This means if you don't register an extension, it is compiled as JavaScript. ES2015 modules) can result in a project that works until you decide to support a feature natively from node.js ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |