@sandros94/deno-bundler

A powerful Deno bundler wrapper with external package resolution

Deno 2.4+ ESM Output CLI & Programmatic

Key Features

📦 External Packages

Automatically rewrites bare specifiers to resolved Deno specifiers (npm:, jsr:, https:)

🔄 String Replacements

Apply arbitrary string replacements to bundled output for runtime adaptation

CLI Support

Flexible command-line interface with intuitive argument parsing

📝 ESM Output

Generates optimized ES modules with optional minification

Quick Start

deno add jsr:@sandros94/deno-bundler

Usage Examples

# Basic usage
deno run -A jsr:@sandros94/deno-bundler

# With external packages
deno run -A jsr:@sandros94/deno-bundler \\
  --entrypoints="./main.ts" \\
  --external="h3,rendu"

# With string replacements
deno run -A jsr:@sandros94/deno-bundler \\
  --replace="Bunny.v1.serve=Bunny.v1.serve" \\
  --replace="Deno.env=Bun.env"
import { build } from "@sandros94/deno-bundler";

const result = await build({
  entrypoints: ["./main.ts"],
  external: ["h3", "rendu"],
  minify: true,
});

console.log(`Bundled in ${result.duration}ms`);
console.log(`Output files: ${result.outputFiles.join(", ")}`);
import { build } from "@sandros94/deno-bundler";

await build({
  entrypoints: ["./main.ts"],
  replace: {
    "Bunny.v1.serve": "Bunny.v1.serve",
    "Deno.env": "Bun.env",
  },
});

Perfect for adapting your Deno code to other runtimes!

Configuration

Option Type Default Description
entrypoints string[] ["./main.ts"] Entry point files to bundle
external string[] [] Packages to mark as external
outputDir string "dist" Output directory for bundled files
minify boolean true Whether to minify the output
replace Record<string, string> {} String replacements to apply