Skip to main content

deno2node

deno doc discord

Transpiles Deno projects into .js and .d.ts for Node.js.

Preparing your project

Rename deps.ts to deps.deno.ts, create corresponding deps.node.ts.

If you’re using some Deno globals not available in Node (Deno, fetch…), export their shims from shim.node.ts, and add the following to your tsconfig.json:

// tsconfig.json
{
  "deno2node": {
    "shim": "src/shim.node.ts"
  }
}

CLI Usage

$ deno run \
  --no-check \
  --allow-read \
  --allow-write  \
  https://deno.land/x/deno2node/src/cli.ts \
  <tsConfigFilePath>

As a by-product of end-to-end testing, Node.js build is also available:

$ npm install --save-dev --save-prefix='~' deno2node
$ deno2node <tsConfigFilePath>