Skip to content

Commit 7e730d3

Browse files
committed
docs: add Hybrid Node module doc about Node16/NodeNext
1 parent 39a1222 commit 7e730d3

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
id: hybrid-node-module
3+
title: Hybrid Node module
4+
---
5+
6+
When using hybrid node `module` values, `Node16`/`Node18`/`NodeNext`, one should read [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/modules/reference.html#node16-node18-nodenext)
7+
to understand how the emitted code looks like.
8+
9+
:::important
10+
11+
At the moment, `ts-jest` uses TypeScript API to transpile code so the emitted `js` code depends on the `TypeScript` version used.
12+
13+
:::
14+
15+
There will be a few differences from traditional `CommonJs`, e.g. `dynamic import` **WON'T** be transformed into `Promise` and `require`.

website/sidebars.js

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = {
2323
collapsed: false,
2424
items: [
2525
'guides/esm-support',
26+
'guides/hybrid-node-module',
2627
'guides/mock-es6-class',
2728
'guides/react-native',
2829
'guides/troubleshooting',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
id: hybrid-node-module
3+
title: Hybrid Node module
4+
---
5+
6+
When using hybrid node `module` values, `Node16`/`Node18`/`NodeNext`, one should read [TypeScript documentation](https://www.typescriptlang.org/docs/handbook/modules/reference.html#node16-node18-nodenext)
7+
to understand how the emitted code looks like.
8+
9+
:::important
10+
11+
At the moment, `ts-jest` uses TypeScript API to transpile code so the emitted `js` code depends on the `TypeScript` version used.
12+
13+
:::
14+
15+
There will be a few differences from traditional `CommonJs`, e.g. `dynamic import` **WON'T** be transformed into `Promise` and `require`.

website/versioned_sidebars/version-29.3-sidebars.json

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"collapsed": false,
2828
"items": [
2929
"guides/esm-support",
30+
"guides/hybrid-node-module",
3031
"guides/mock-es6-class",
3132
"guides/react-native",
3233
"guides/troubleshooting",

0 commit comments

Comments
 (0)