Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

tsx

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tsx

Node.js runtime enhanced with esbuild for loading TypeScript & ESM

Source
npmnpm
Version
2.0.1
Version published
Weekly downloads
13M
-5.94%
Maintainers
1
Weekly downloads
 
Created
Source

tsx

Node.js runtime that can instantaneously load TypeScript & ESM, powered by esbuild.

Features

  • Transforms TypeScript & ESM → to CJS or ESM (depending on package type)
  • Supports TS extensions .cjs & .mjs (.cts & .mts)
  • Supports Node.js v12.20+
  • Handles node: import prefixes
  • Hides experimental feature warnings

Install

npm install --save-dev tsx

Install globally

Install it globally to use it anywhere, outside of your npm project, without npx.

npm install --global tsx

Usage

Note: Commands are prefixed with npx to execute the tsx binary, but it's not necessary if globally installed or when using it in the script object in package.json

Run TypeScript / ESM / CJS module

npx tsx ./file.ts

Watch mode

Run file and automatically re-run on changes.

All imported files are watched except from the following directories: node_modules, bower_components, vendor, dist, and .* (hidden directories).

Press Return to manually re-run.

npx tsx watch ./file.ts

Cache

Modules transformations are cached in the system cache directory (TMPDIR). Transforms are cached by content hash so duplicate dependencies are not re-transformed.

Set the --no-cache flag to disable the cache:

npx tsx --no-cache ./file.ts

Dependencies

Keywords

esbuild

FAQs

Package last updated on 11 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts