Skip to content

maplibre

The maplibre registry script. It loads https://unpkg.com/maplibre-gl@5.6.0/dist/maplibre-gl.js for the input of the example. Call useScriptMaplibre(input, options?) from @hamur/scripts/<library> in a component, or list it under scripts.registry.maplibre to load it on every page.

Config keyscripts.registry.maplibre
FunctionuseScriptMaplibre of @hamur/scripts/<library>
Input keysversion
Default triggermanual
Scripthttps://unpkg.com/maplibre-gl@5.6.0/dist/maplibre-gl.js
Hostsunpkg.com
Bundleyes: scripts.bundle: ["maplibre"]
Collection proxyno
Consentnone

Example

ts
import { defineConfig } from "hamur";
import scripts from "@hamur/scripts";

export default defineConfig({
  framework: "react",
  modules: [scripts],
  scripts: {
    registry: {
      maplibre: { version: "5.6.0" },
    },
  },
});

It loads when load() is called or when the trigger you pass fires. List maplibre in scripts.bundle and the build serves the file from your origin with a SHA-384 integrity (see Bundling). The script sends its own requests to the vendor.

Every key is checked when the config loads and again in useScriptMaplibre: a wrong value stops the build with a message that starts with scripts.registry.maplibre. The registry list is on the registry page, and the shared options are in Scripts.