Getting Started with Deno — Deno's Built-In Tooling

Bundling Your Code


Deno comes with the ability to bundle your scripts into a single JavaScript file that can be run or imported into other scripts. Here's how the command works:

$ deno bundle /path/to/file.ts output.js

When you run this command, Deno will look at the input file and include any necessary external scripts so that it can generate the output.js file.

The bundle command combines all the code referenced in the input file into a single script. That way you don't have to ship multiple files; you will just need to ship the single bundled file.

The great thing about this command is that it comes built in and there's nothing special needed to run it. Just provide the path to a script and then an output file to write to. If you don't provide the output file, the output will be printed to the console.