Bundler (deprecated)
Command line usage
deno bundle [OPTIONS] [file]...
Output a single JavaScript file with all dependencies.
deno bundle https://deno.land/std/examples/colors.ts colors.bundle.js
If no output file is given, the output is written to standard output:
deno bundle https://deno.land/std/examples/colors.ts
Type checking options Jump to heading
--check
Jump to heading
Enable type-checking. This subcommand does not type-check by default If the value of "all" is supplied, remote modules will be included. Alternatively, the 'deno check' subcommand can be used.
--no-check
Jump to heading
Skip type-checking. If the value of "remote" is supplied, diagnostic errors from remote modules will be ignored.
Dependency management options Jump to heading
--frozen
Jump to heading
Error out if lockfile is out of date.
--import-map
Jump to heading
Load import map file from local file or remote URL.
--lock
Jump to heading
Check the specified lock file. (If value is not provided, defaults to "./deno.lock").
--no-lock
Jump to heading
Disable auto discovery of the lock file.
--no-npm
Jump to heading
Do not resolve npm modules.
--no-remote
Jump to heading
Do not resolve remote modules.
--node-modules-dir
Jump to heading
Sets the node modules management mode for npm packages.
--reload
Jump to heading
Short flag: -r
Reload source code cache (recompile TypeScript) no value Reload everything jsr:@std/http/file-server,jsr:@std/assert/assert-equals Reloads specific modules npm: Reload all npm modules npm:chalk Reload specific npm module.
--vendor
Jump to heading
Toggles local vendor folder usage for remote modules and a node_modules folder for npm packages.
Options Jump to heading
--allow-import
Jump to heading
Short flag: -I
Allow importing from remote hosts. Optionally specify allowed IP addresses and host names, with ports as necessary. Default value: deno.land:443,jsr.io:443,esm.sh:443,cdn.jsdelivr.net:443,raw.githubusercontent.com:443,user.githubusercontent.com:443.
--allow-scripts
Jump to heading
Allow running npm lifecycle scripts for the given packages
Note: Scripts will only be executed when using a node_modules directory (--node-modules-dir
).
--cert
Jump to heading
Load certificate authority from PEM encoded file.
--code-splitting
Jump to heading
Enable code splitting.
--config
Jump to heading
Short flag: -c
Configure different aspects of deno including TypeScript, linting, and code formatting.
Typically the configuration file will be called deno.json
or deno.jsonc
and
automatically detected; in that case this flag is not necessary.
--external
Jump to heading
--format
Jump to heading
--minify
Jump to heading
Minify the output.
--no-config
Jump to heading
Disable automatic loading of the configuration file.
--one-file
Jump to heading
Bundle into one file.
--outdir
Jump to heading
Output directory for bundled files.
--output
Jump to heading
Short flag: -o
Output path`.
--packages
Jump to heading
How to handle packages. Accepted values are 'bundle' or 'external'.
--unstable-node-conditions
Jump to heading
deno bundle
has been deprecated and will be removed in some future release.
Use deno_emit,
esbuild or rollup instead.
deno bundle [URL]
will output a single JavaScript file for consumption in
Deno, which includes all dependencies of the specified input. For example:
$ deno bundle https://deno.land/std@0.190.0/examples/colors.tsts colors.bundle.js
Bundle https://deno.land/std@0.190.0/examples/colors.ts
Download https://deno.land/std@0.190.0/examples/colors.ts
Download https://deno.land/std@0.190.0/fmt/colors.ts
Emit "colors.bundle.js" (9.83KB)
If you omit the out file, the bundle will be sent to stdout
.
The bundle can just be run as any other module in Deno would:
deno run colors.bundle.js
The output is a self contained ES Module, where any exports from the main module supplied on the command line will be available. For example, if the main module looked something like this:
export { foo } from "./foo.js";
export const bar = "bar";
It could be imported like this:
import { bar, foo } from "./lib.bundle.js";
Bundling for the Web Jump to heading
The output of deno bundle
is intended for consumption in Deno and not for use
in a web browser or other runtimes. That said, depending on the input it may
work in other environments.
If you wish to bundle for the web, we recommend other solutions such as esbuild.