Skip to content

Commit 537fa39

Browse files
authoredOct 5, 2024··
docs: add note about interop default
1 parent 61891a0 commit 537fa39

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed
 

‎README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,14 @@
2323
- Super slim and zero dependency
2424
- Custom resolve aliases
2525
- Smart syntax detection to avoid extra transforms
26-
- Node.js native require cache integration
26+
- Node.js native `require.cache` integration
2727
- Filesystem transpile with hard disk caches
2828
- ESM Loader support
2929
- JSX support (opt-in)
3030

31+
> [!IMPORTANT]
32+
> To enhance npm compatibility with the introduction of native ESM, jiti `>=2.1` enabled [`interopdefault`](https://github.com/unjs/jiti#interopdefault) using a new Proxy. This may cause behavior changes, especially if you migrated to `2.0.0` earlier, you might need to explicitly use the `.default` value of `jiti()`/`jiti.import()`.
33+
3134
## 💡 Usage
3235

3336
### CLI
@@ -72,15 +75,15 @@ jiti("./path/to/file.ts");
7275
const resolvedPath = jiti.resolve("./src");
7376
```
7477
75-
You can also pass options as second argument:
78+
You can also pass options as the second argument:
7679
7780
```js
7881
const jiti = createJiti(import.meta.url, { debug: true });
7982
```
8083
8184
### Register global ESM loader
8285
83-
You can globally register jiti using [global hooks](https://nodejs.org/api/module.html#initialize). (important: Requires Node.js > 20)
86+
You can globally register jiti using [global hooks](https://nodejs.org/api/module.html#initialize). (Important: Requires Node.js > 20)
8487
8588
```js
8689
import "jiti/register";
@@ -116,7 +119,7 @@ Filesystem source cache (enabled by default)
116119
117120
By default (when is `true`), jiti uses `node_modules/.cache/jiti` (if exists) or `{TMP_DIR}/jiti`.
118121
119-
**Note:** It is recommended to keep this option enabled for better performance.
122+
**Note:** It is recommended that this option be enabled for better performance.
120123
121124
### `moduleCache`
122125

0 commit comments

Comments
 (0)