Lesson 14 / 30
Targeting Node.js Versions
Configure transpilation for backend Node.js environments.
Node 16+ supports most ES2021 features
Modern Node.js versions (16+, 18+, 20+) support async/await, const, arrow functions, destructuring, and more natively. You often don't need transpilation at all.
Node target configuration
Set targets.node to specify minimum Node version. Babel then transpiles only incompatible features.
// Target Node 18+: minimal transpilation
{
"presets": [
["@babel/preset-env", { "targets": { "node": "18" } }]
]
}
// Target Node 12: more transpilation
{
"presets": [
["@babel/preset-env", { "targets": { "node": "12" } }]
]
}Modern Node backends rarely need Babel
If your backend runs Node 18+, consider skipping Babel entirely and using TypeScript for type checking only. Faster builds, simpler setup.