Deno's compatibility with Node.js modules means developers can use many existing packages without rewriting them. This reduces the effort and time needed to migrate projects.
import express from "npm:express"; console.log(typeof express);
Deno's Node.js compatibility allows importing many Node.js packages like 'express' using standard import syntax. The imported 'express' is a function as expected.
import fs from 'fs'; console.log(typeof fs.readFileSync);
Deno does not natively support Node.js built-in modules like 'fs' without enabling compatibility flags or using shims. This causes import errors.
import { join } from "node:path"; const result = join('folder', 'file.txt'); console.log(result);
Deno's Node.js compatibility supports the 'path' module and uses POSIX style paths by default, so 'folder/file.txt' is printed.
Deno uses ES module syntax. For CommonJS packages like 'lodash', importing all as a namespace with 'import * as _ from "lodash"' works correctly.
