On this page
Interoperability with Node.js
Description of video Jump to heading
Deno gained lots of interpoperability capabilities at its v2.0 release. In this video, we'll look at how to use Node.js built-in APIs, NPM modules, and JSR packages.
Transcript and examples Jump to heading
Deno 2.0 is here, and it's good. One of the most amazing features of Deno is its interoperability with other platforms including Node. For example, we can use the core Node.js built in APIs. All we have to do is add this Node specifier here.
import { fs } from "node:fs/priomses";
Deno also supports the use of NPM modules. All you need to do is add the NPM specifier with your import and you're good to go.
import { * } as Sentry from "npm:@sentry/node";
We can also take advantage of JSR, an open source package registry for TypeScript and JavaScript.
import OpenAI from "jsr:@openai/openai";
JSR works with Deno, of course, but also with Node.js. bun, and CloudFlare workers. You can even install JSR packages into Vite and Next.js applications.
Deno also gives us
import maps,
which help us manage our dependencies. You can install a package from JSR. The
import will be added to the deno.json
, and you can even use a shorthand to
describe this to clean up your code even more. Deno 2.0 is focused on a really
solid developer experience. New projects and migrations feel a whole lot easier
with Deno.