Skip to content

Maplibre-gl no longer supports UMD #5716

Description

@andysellick

We use the DEFRA map in frontends map component. In order to have it function correctly within our CSP we rely upon maplibre-gls CSP worker, which is used in place of the default.

Unfortunately, as of v6 of maplibre-gl the UMD approach has been removed, and can only be used with ES6 modules. Our Rails setup does not yet support this, so we've had to pin to an older version of maplibre-gl.

Context

Recording in case this is helpful.

We currently use the UMD approach for the DEFRA map. This works as follows:

ES modules

The alternative to UMD is ES modules. We currently can't use ES modules on GOV.UK because of our asset pipeline, which compiles and fingerprints our JS files. Typical ES modules syntax such as the following will fail because the JS doesn't know the fingerprinted name of the file it is trying to import.

import { name as squareName, draw } from "./shapes/square.js"; // fails
// square.js is output from the asset pipeline as square-[unknown fingerprint].js

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtPull requests which introduce tech debt

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions