Skip to content

Commit

Permalink
docs: clarify loader limitations
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Oct 2, 2022
1 parent e2fc0e1 commit edde6b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -121,9 +121,9 @@ tsx --no-cache ./file.ts

`tsx` is a standalone binary designed to be used in place of `node`, but sometimes you'll want to use `node` directly. For example, when adding TypeScript & ESM support to npm-installed binaries.

To use `tsx` with Node.js, pass it to the [`--loader`](https://nodejs.org/api/esm.html#loaders) flag.
To use `tsx` as a Node.js loader, simply pass it in to the [`--loader`](https://nodejs.org/api/esm.html#loaders) flag.

> Note: Node.js's experimental feature warnings will not be suppressed when used as a loader.
> Note: The loader is limited to adding support for loading TypeScript/ESM files. CLI features such as _watch mode_ or suppressing "experimental feature" warnings will not be available.
```sh
# As a CLI flag
Expand All @@ -135,7 +135,7 @@ NODE_OPTIONS='--loader tsx' node ./file.ts

> Tip: In rare circumstances, you might be limited to using the [`-r, --require`](https://nodejs.org/api/cli.html#-r---require-module) flag.
>
> You can use [`@esbuild-kit/cjs-loader`](https://github.com/esbuild-kit/cjs-loader), but transformations will only be applied to `require()`.
> You can use [`@esbuild-kit/cjs-loader`](https://github.com/esbuild-kit/cjs-loader), but transformations will only be applied to `require()` (not `import`).
## Dependencies

Expand Down

0 comments on commit edde6b1

Please sign in to comment.