type: reference title: "Prebuilt browser bundle (CDN / build-less)" description: "The prebuilt, self-contained browser bundle for static sites and build-less pages: artifacts, CDN usage, and what is bundled versus external." resource: "https://www.npmjs.com/package/@honua/sdk-js"

Prebuilt browser bundle (CDN / build-less)

@honua/sdk-js ships ESM + TypeScript types as its canonical output, intended for consumption through a bundler (Vite, webpack, esbuild, Rollup) or Node. For static sites, quick prototypes, and CSP-strict pages that cannot run their own bundler, the package also publishes a prebuilt, self-contained browser bundle under dist/browser/.

This is an additive artifact — it does not change the ESM/exports/types surface. Production apps should keep importing from @honua/sdk-js (and its subpaths) through their bundler; the browser bundle exists only for build-less consumers.

Artifacts

File Format Use
dist/browser/honua-sdk.min.js minified IIFE (globalName: HonuaSDK) <script> tags, unpkg, jsDelivr
dist/browser/honua-sdk.esm.js minified ESM <script type="module">, esm.sh, native CDN imports

The bundle targets es2020. External .map sourcemaps are generated as separate debug build artifacts; they are excluded from the runtime npm package and its CDN file inventory. The browser integrity manifest lists the two shipped JavaScript bundles.

The package.json browser, unpkg, and jsdelivr fields point at the IIFE build, and the ./browser subpath export points at the ESM build, so ESM CDNs that resolve subpaths (e.g. esm.sh) can serve it directly.

Usage — global <script> (IIFE)

<script src="https://cdn.jsdelivr.net/npm/@honua/sdk-js/dist/browser/honua-sdk.min.js"></script>
<script>
  // The reviewed root API of `@honua/sdk-js` is on window.HonuaSDK.
  const client = new HonuaSDK.HonuaClient({
    baseUrl: "https://your-honua-server.example",
  });

  const dataset = HonuaSDK.createDataset({
    id: "parcels",
    client,
    sources: [{ id: "parcels-fs", protocol: "geoservices", url: "https://.../FeatureServer/0" }],
  });
</script>

unpkg works the same way:

<script src="https://unpkg.com/@honua/sdk-js/dist/browser/honua-sdk.min.js"></script>

Usage — native ES module (ESM)

<script type="module">
  import { HonuaClient, createDataset } from "https://esm.sh/@honua/sdk-js/browser";

  const client = new HonuaClient({ baseUrl: "https://your-honua-server.example" });
</script>

What's bundled vs. external

The bundle is focused on the core SDK public API (everything re-exported from src/index.ts). Its stable-core runtime dependency, @maplibre/maplibre-gl-style-spec, is bundled in. The package manifest has two other bounded direct dependencies: @honua/honua-migrate backs deprecated migration forwarders outside the browser graph, and @mapbox/jsonlint-lines-primitives@2.0.2 temporarily pins style-spec's existing parser. That pin originated with the earlier Node 20 compatibility work and remains unchanged under the current Node 22.12+ runtime requirement.

The heavy runtime peers are kept external so the artifact stays small and does not inline multi-megabyte map/protobuf runtimes:

If you use a part of the SDK that needs one of these (e.g. the MapLibre runtime or gRPC transport), load that peer yourself — for the IIFE build, ensure it is available on the page before the code path that needs it runs.