0
# Node.js Configurations
1
2
TypeScript configurations optimized for different Node.js versions and deployment patterns. Each configuration provides environment-specific compiler options, library support, and module systems.
3
4
## Capabilities
5
6
### Node.js LTS (Long Term Support)
7
8
Current LTS configuration targeting Node.js 22 with modern JavaScript features and optimal performance settings.
9
10
```typescript { .api }
11
interface NodeLTSConfiguration {
12
/** Current Node.js LTS version */
13
target: "Node.js 22";
14
15
/** Package name */
16
package: "@tsconfig/node-lts";
17
18
/** Configuration */
19
config: {
20
$schema: "https://json.schemastore.org/tsconfig";
21
display: "Node LTS (22)";
22
_version: "22.0.0";
23
compilerOptions: {
24
lib: ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Iterator"];
25
module: "nodenext";
26
target: "es2022";
27
strict: true;
28
esModuleInterop: true;
29
skipLibCheck: true;
30
moduleResolution: "node16";
31
};
32
};
33
}
34
```
35
36
**Installation:**
37
```bash
38
npm install --save-dev @tsconfig/node-lts
39
```
40
41
**Usage:**
42
```json
43
{
44
"extends": "@tsconfig/node-lts/tsconfig.json"
45
}
46
```
47
48
### Node.js with TypeScript (TS 5.8+)
49
50
Special configuration for projects using TypeScript's advanced features, requiring TypeScript 5.8 or higher.
51
52
```typescript { .api }
53
interface NodeTSConfiguration {
54
/** TypeScript version requirement */
55
requirement: "TypeScript 5.8+";
56
57
/** Package name */
58
package: "@tsconfig/node-ts";
59
60
/** Configuration */
61
config: {
62
$schema: "https://json.schemastore.org/tsconfig";
63
display: "Node with TypeScript";
64
_version: "1.0.0";
65
compilerOptions: {
66
module: "esnext";
67
target: "esnext";
68
moduleResolution: "bundler";
69
allowImportingTsExtensions: true;
70
noEmit: true;
71
};
72
};
73
}
74
```
75
76
**Installation:**
77
```bash
78
npm install --save-dev @tsconfig/node-ts
79
```
80
81
**Usage (typically combined with other Node configs):**
82
```json
83
{
84
"extends": ["@tsconfig/node22/tsconfig.json", "@tsconfig/node-ts/tsconfig.json"]
85
}
86
```
87
88
### Specific Node.js Versions
89
90
Individual configurations for specific Node.js versions, each optimized for that version's capabilities.
91
92
```typescript { .api }
93
interface SpecificNodeVersions {
94
/** Node.js 10 (Legacy) */
95
"node10": {
96
package: "@tsconfig/node10";
97
target: "es2018";
98
module: "commonjs";
99
lib: ["es2018"];
100
};
101
102
/** Node.js 12 (Legacy) */
103
"node12": {
104
package: "@tsconfig/node12";
105
target: "es2019";
106
module: "commonjs";
107
lib: ["es2019"];
108
};
109
110
/** Node.js 14 */
111
"node14": {
112
package: "@tsconfig/node14";
113
target: "es2020";
114
module: "commonjs";
115
lib: ["es2020"];
116
};
117
118
/** Node.js 16 */
119
"node16": {
120
package: "@tsconfig/node16";
121
target: "es2021";
122
module: "commonjs";
123
lib: ["es2021"];
124
};
125
126
/** Node.js 17 */
127
"node17": {
128
package: "@tsconfig/node17";
129
target: "es2021";
130
module: "commonjs";
131
lib: ["es2021"];
132
};
133
134
/** Node.js 18 */
135
"node18": {
136
package: "@tsconfig/node18";
137
target: "es2022";
138
module: "commonjs";
139
lib: ["es2022"];
140
};
141
142
/** Node.js 19 */
143
"node19": {
144
package: "@tsconfig/node19";
145
target: "es2022";
146
module: "commonjs";
147
lib: ["es2022"];
148
};
149
150
/** Node.js 20 */
151
"node20": {
152
package: "@tsconfig/node20";
153
target: "es2022";
154
module: "nodenext";
155
lib: ["es2023"];
156
moduleResolution: "node16";
157
};
158
159
/** Node.js 21 */
160
"node21": {
161
package: "@tsconfig/node21";
162
target: "es2022";
163
module: "nodenext";
164
lib: ["es2023"];
165
moduleResolution: "node16";
166
};
167
168
/** Node.js 22 */
169
"node22": {
170
package: "@tsconfig/node22";
171
target: "es2022";
172
module: "nodenext";
173
lib: ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Iterator"];
174
moduleResolution: "node16";
175
};
176
177
/** Node.js 23 */
178
"node23": {
179
package: "@tsconfig/node23";
180
target: "es2022";
181
module: "nodenext";
182
lib: ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Iterator"];
183
moduleResolution: "node16";
184
};
185
186
/** Node.js 24 */
187
"node24": {
188
package: "@tsconfig/node24";
189
target: "es2022";
190
module: "nodenext";
191
lib: ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Iterator"];
192
moduleResolution: "node16";
193
};
194
}
195
```
196
197
## Usage Patterns
198
199
### Basic Node.js Project
200
201
For a simple Node.js application, choose the version-specific configuration:
202
203
```json
204
{
205
"extends": "@tsconfig/node20/tsconfig.json",
206
"compilerOptions": {
207
"outDir": "./dist",
208
"rootDir": "./src"
209
},
210
"include": ["src/**/*"],
211
"exclude": ["node_modules", "dist"]
212
}
213
```
214
215
### LTS-Based Development
216
217
For production applications following LTS releases:
218
219
```json
220
{
221
"extends": "@tsconfig/node-lts/tsconfig.json",
222
"compilerOptions": {
223
"outDir": "./build",
224
"declaration": true,
225
"declarationMap": true
226
}
227
}
228
```
229
230
### Modern Node.js with Advanced TypeScript
231
232
For projects using cutting-edge TypeScript features:
233
234
```json
235
{
236
"extends": [
237
"@tsconfig/node22/tsconfig.json",
238
"@tsconfig/node-ts/tsconfig.json"
239
],
240
"compilerOptions": {
241
"experimentalDecorators": true,
242
"emitDecoratorMetadata": true
243
}
244
}
245
```
246
247
### Legacy Node.js Support
248
249
For projects supporting older Node.js versions:
250
251
```json
252
{
253
"extends": "@tsconfig/node14/tsconfig.json",
254
"compilerOptions": {
255
"downlevelIteration": true,
256
"importHelpers": true
257
}
258
}
259
```
260
261
## Configuration Evolution
262
263
Node.js configurations evolve with the platform:
264
265
```typescript { .api }
266
interface ConfigurationEvolution {
267
/** Legacy versions (Node 10-13) */
268
legacy: {
269
target: "es2018" | "es2019";
270
module: "commonjs";
271
features: "Basic ES features";
272
};
273
274
/** Stable versions (Node 14-19) */
275
stable: {
276
target: "es2020" | "es2021" | "es2022";
277
module: "commonjs";
278
features: "Modern ES features";
279
};
280
281
/** Modern versions (Node 20+) */
282
modern: {
283
target: "es2022";
284
module: "nodenext";
285
moduleResolution: "node16";
286
features: "Full ES2024 support";
287
};
288
}
289
```