Skip to content

Internal package to build bundles (using esbuild) for use in various environments

Notifications You must be signed in to change notification settings

11ty/package-bundler

Repository files navigation

@11ty/package-bundler

Internal package to build Eleventy core and plugin bundles (using esbuild, with support for adapters) for use in various environments (client).

Usage

npm install @11ty/package-bundler
import bundle from "@11ty/package-bundler";

await bundle(INPUT, OUTPUT, {
  name: "Eleventy Fetch",
  minimalBundle: false,
  fileSystemMode: "consume",
  external: [
    "chokidar",
    "fs",
    "node:fs",
    "node:crypto",
  ],
  moduleRoot: ".", // root directory to resolve node_modules paths
  esbuild: {}, // options passed to esbuild
});

Sample

import pkg from "../package.json" with { type: "json" };
import bundle from "@11ty/package-bundler";

await bundle(import.meta.resolve("@11ty/eleventy-fetch"), `demo/lib/eleventy-fetch.js`, {
  name: "Eleventy Fetch",
});
await bundle(import.meta.resolve("@11ty/eleventy-plugin-syntaxhighlight"), `demo/lib/eleventy-plugin-syntaxhighlight.js`, {
  name: "Eleventy Syntax Highlighter",
});
await bundle(import.meta.resolve("@11ty/eleventy-navigation"), `demo/lib/eleventy-navigation.js`, {
  name: "Eleventy Navigation",
});
await bundle(import.meta.resolve("@11ty/eleventy-plugin-rss"), `demo/lib/eleventy-plugin-rss.js`, {
  name: "Eleventy RSS",
});
await bundle(import.meta.resolve("@11ty/eleventy-img"), `demo/lib/eleventy-img.js`, {
  name: "Eleventy Image",
});

About

Internal package to build bundles (using esbuild) for use in various environments

Resources

Stars

Watchers

Forks

Packages

No packages published