Skip to main content
Deno 2 is finally here 🎉️
Learn more

Asset bundler for Deno apps

deno-buckets logo
deno-buckets

deno doc GitHub License GitHub release (latest by date)

Buckets is a wrapper around the native Deno bundler, it allows you to select source files, and then bundle their resolved default exports.

Example

numbers.json:

{
  "one": 1,
  "two": 2
}

data.ts:

// is-deno-bucket
const __dirname = new URL(".", import.meta.url).pathname;
const rawData = Deno.readTextFileSync(__dirname + "mydata.json");
export default JSON.parse(rawData);

app.ts:

import data from "./data.ts";
export default data;

Then run: deno-buckets app.ts and you’ll get app.bundle.js:

const __default = {
  "one": 1,
  "two": 2,
};
export { __default as default };

Usage

Add the comment // is-deno-bucket at the beginning of the files you want to resolve before bundling. Only the default export will be prebundled. Then, bundle your app with deno-buckets.

CLI

Install:

deno install --unstable --allow-net --allow-read --allow-write https://deno.land/x/buckets/deno-buckets.ts

Run:

deno-buckets <entry_path> [destination_path]

API

import bundler from "https://deno.land/x/buckets/mod.ts";

const bundle = bundler("./app.ts");
Deno.writeTextFileSync("app.bundle.js", bundle);


© 2021 Jacobo Tabernero Rey - Released under MIT License