Skip to content

Commit

Permalink
docs: emphasize ESM interop
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber authored Dec 2, 2023
1 parent ec7fd00 commit 420fdea
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ This is for you if you ever wanted:
- Better interoperability in codebases that use ESM and CJS dependencies
- Something really fast it's unnoticeable!

> [!TIP]
> **tsx is not just for TypeScript!** It also helps Node load `module` type packages.
>
> If you're getting the following error, give _tsx_ a try!
> ```
> require('ESM package');
> ^
>
> Error [ERR_REQUIRE_ESM]: require() of ES Module <ESM package> from ./file.js not supported.
> Instead change the require of <ESM package> in ./file.js to a dynamic import() which is available in all CommonJS modules.
> ```
### Quick start
Try tsx now without setup! Just pass in a TypeScript file:
Expand All @@ -46,7 +59,6 @@ npx tsx ./script.ts
2. Improve ESM <-> CJS interoperability as the ecosystem migrates to ESM
3. Support the [LTS versions of Node.js](https://endoflife.date/nodejs)


## Install

### Local installation
Expand Down

0 comments on commit 420fdea

Please sign in to comment.