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 key | scripts.registry.maplibre |
| Function | useScriptMaplibre of @hamur/scripts/<library> |
| Input keys | version |
| Default trigger | manual |
| Script | https://unpkg.com/maplibre-gl@5.6.0/dist/maplibre-gl.js |
| Hosts | unpkg.com |
| Bundle | yes: scripts.bundle: ["maplibre"] |
| Collection proxy | no |
| Consent | none |
Example
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.