Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback


📦 Zero-config web application packager in Deno
Go to Latest
import { denoPlugin, esbuild, resolve } from "./deps.ts";
let esbuildReady: null | Promise<void> = null;function ensureEsbuildInialized() { if (esbuildReady) { return esbuildReady; } console.log("Using esbuild bundler"); const timeStarted =; return esbuildReady = esbuild.initialize({ //wasmURL: esbuildWasm, wasmURL: "", worker: false, }).then(() => { const timeEnded =; console.log(`Esbuild initialized in ${timeEnded - timeStarted}ms`); });}
export async function bundleByEsbuild(path: string): Promise<string> { await ensureEsbuildInialized();
const bundle = await{ entryPoints: [resolve(path)], plugins: [denoPlugin()], bundle: true, });
return bundle.outputFiles![0].text;}
let usingSwcLogged = false;export async function bundleBySwc(path: string): Promise<string> { if (!usingSwcLogged) { console.log("Using swc bundler"); usingSwcLogged = true; } const res = await Deno.emit(path, { bundle: "classic", check: false, }); return res.files["deno:///bundle.js"];}