Nodea — logo

Transpiler

A transpiler, short for source-to-source compiler, is a tool that translates code from one language or version into another at a similar level of abstraction. Unlike a traditional compiler that turns source into low-level machine code, a transpiler produces code that is still human-readable — for example converting modern JavaScript syntax into an older version that more browsers understand.

Why transpilers exist

Programming languages evolve faster than the environments that run them. Developers want to use the latest features for cleaner, safer code, but users' browsers and runtimes may not support that syntax yet. A transpiler bridges the gap: engineers write in the newest form, and the transpiler rewrites it into an equivalent, widely compatible version before it ships. This lets teams adopt modern language features without abandoning users on older platforms.

Transpilers in practice

The best-known example in web development is Babel, which converts modern JavaScript into a form that runs in older browsers. Another is TypeScript, which adds a type system on top of JavaScript and is transpiled down to plain JavaScript for execution. Transpilation is usually one step in a larger build process, run automatically by a bundler such as webpack, so developers rarely invoke it by hand. It has become a standard part of working with any modern framework, where the code you write and the code that ships to the browser are deliberately different. The result is a workflow in which teams write expressive, up-to-date code while the transpiler quietly guarantees that it still works everywhere it needs to.

Powiązane pojęcia

Najczęstsze pytania

How is a transpiler different from a compiler?

A traditional compiler translates code into a lower-level form, such as machine code. A transpiler translates between languages or versions at a similar level — for example newer JavaScript into older JavaScript — so the output is still human-readable source code.