Skip to content
IT glossary
FrontendUpdated December 3, 2026

Transpiler

Транспилятор

A transpiler rewrites source code into another language or another version of the same language while preserving what the program does. For example, it can turn modern JavaScript syntax into syntax older browsers understand.

Also known as: Babel

What a transpiler does

A transpiler is a source-to-source compiler: what it reads and what it produces are both source code. In a frontend project, that usually means turning TypeScript or JSX into JavaScript, or rewriting newer JavaScript syntax for older runtimes. Babel is one tool that does this. It isn't another name for the category; SWC and esbuild can transpile code too.

How it fits into a build

A tool like Babel parses a file into an abstract syntax tree (AST), a structured representation of the program. Configured transformations rewrite parts of that tree, and a code generator turns the result back into text. The @babel/preset-env preset uses the project's target browsers or Node.js versions to decide which JavaScript features need rewriting. Setting realistic targets avoids doing work and shipping extra code for environments the project doesn't support.

A transpiler can also emit source maps. These map positions in the output back to the original files, so you can set a breakpoint in TypeScript even though the browser is executing JavaScript.

Example: optional chaining

// Before
function getName(user) {
  return user?.name;
}

// One possible output
function getName(user) {
  return user === null || user === void 0 ? void 0 : user.name;
}

Both versions return undefined if user is null or undefined; otherwise they read user.name. Here void 0 evaluates to undefined. The output is more verbose, but it doesn't require the browser to understand ?..

What transpilation doesn't do

A bundler follows imports and packages modules into files the application can load. Transpilation changes the code inside those modules. A single build tool may do both, but you can also transpile a single file without bundling anything.

A polyfill supplies a missing API at runtime. A syntax transform can make ?. parse in an older browser, but it won't make Array.prototype.includes exist there. Likewise, Babel can strip TypeScript type annotations without checking whether those types are used correctly. Teams that use Babel for JavaScript output can run tsc --noEmit separately to check types.

In a frontend interview

If a freshly built app fails in one supported browser, start by distinguishing a parse error from a runtime error. An unexpected token at ?. points toward the build targets or a file that skipped transformation. A missing includes method means the code parsed but relied on an unavailable API. Check browser support before deciding whether to add a polyfill or use another implementation.