Deno 2.0 looks to backward compatibility to move forward

Modern runtime for JavaScript and TypeScript plays nicer with Node.js

by · The Register

Deno, the runtime for JavaScript and TypeScript, reached version 2.0 on Wednesday, bringing with it baggage from the past in the form of broad Node.js compatibility.

The project debuted in May 2020 when Ryan Dahl attempted to address problems he saw with Node.js, the JavaScript runtime he released in May 2009 and which he later admitted included “design mistakes made that just cannot be corrected now because there's so much software there that uses it.”

JavaScript's traditional runtime environment was the web browser. Node.js is a runtime environment that allows JavaScript code to execute without a browser – on a server, for example.

Deno represents an attempt to address the shortcomings of Node.js and deliver "a modern, all-in-one, zero-config toolchain for JavaScript and TypeScript development," as described by Dahl, Bert Belder, Bartek Iwańczuk, and Andy Jiang, in a blog post.

Deno is written in Rust and based on the V8 engine that powers Chromium browsers. "Rust has been crucial to Deno’s development, especially with Rusty V8, recently stabilized," Dahl told The Register. "Rust's unified build system simplifies adding third-party functionality compared to C++, keeping Deno fast and reliable for server-side apps."

The long-awaited version 2.0 milestone is backward compatible with Node.js and npm – a feat prior versions did not achieve.

"Deno 2.0 understands package.json , the node_modules folder, and even npm workspaces, allowing you to run Deno in any Node project using ESM," explain Dahl, Belder, Iwańczuk, and Jiang.

The runtime also supports various popular web frameworks like Angular, Astro, Next.js, QwikCity, Remix, and SvelteKit.

Deno itself is now a package manager, along the lines of npm. Using the deno install command, developers can install project dependencies. For those using a package.json file, it will create a node_modules folder. Otherwise, it will store dependencies in the global cache. And as their names suggest, the deno add and deno remove commands allow packages to be added or removed from package.json or deno.json files.

Among other noteworthy features, Dahl pointed to the stabilized standard library, support for private npm registries, workspaces and monorepo support, long term support (LTS) release, and the JSR registry for sharing JavaScript libraries across runtimes.

He also called out Deno's speed, particularly in the context of cold starts when invoking functions in AWS Lambda.

While Deno adoption trails Node.js, Dahl said usage is growing. "With 2.0’s broader compatibility and new features, we expect growth to continue," he said. "It makes trying Deno easier for node developers while keeping a modern, secure experience."

Bun, a rival runtime, reached 1.0 last year, and Dahl said he welcomed the challenge.

"Bun is a competitor – but competition in this space is healthy," he said. "It pushes us all to improve the language and ecosystem. Unlike bun, Deno’s goal isn’t to be a node clone in Rust or a drop-in replacement – rather we aim to advance JavaScript beyond 2010-era CommonJS and narrow the gap between server-side and browser environments.

"We believe JavaScript can evolve beyond mismatched tooling and endless layers of transpilation. Our vision includes native TypeScript support, built on web standards like promises, top-level await, wasm, fetch, and ES modules, all in a single, dependency-free executable. Deno is secure by default, like the web." ®