rusackas opened a new pull request, #44042:
URL: https://github.com/apache/superset/pull/44042
### SUMMARY
`master` currently ships maplibre-gl 6.8.0 (landed via #44030, a Dependabot
security-group bump I merged without catching that it carried this jump),
unmitigated — a live regression.
maplibre-gl 6's ESM-only build derives its worker URL from
`import.meta.url`, which webpack rewrites to a build-time `file://` path that
fails maplibre's `^https?:` check, so `WORKER_URL` silently resolves to `''`
and no worker is created. Vector tile maps can fail to load, silently, with no
error surfaced anywhere jest/lint/type-check would catch.
This extends the existing `CopyPlugin` in `webpack.config.js` to emit
`maplibre-gl-worker.mjs` and its sibling `maplibre-gl-shared.mjs` (the worker's
own relative ESM import — both must land in the same output dir) into the
static asset output, and calls `maplibregl.setWorkerUrl(...)` with the
runtime-configurable public path before any MapLibre map can mount.
`DEFAULT_MAX_ZOOM`/`DEFAULT_POINT_RADIUS` move to a new
`mapLibreDefaults.ts` so `transformProps.ts` (and its tests) don't have to pull
in `MapLibre.tsx`'s `maplibre-gl` import merely to read two constants — that
import isn't resolvable in Jest's CJS environment, which is also why a
`jest.mock(..., {virtual:true})` was added.
### TESTING INSTRUCTIONS
Verified via:
- A full webpack build — confirmed `import.meta.url` really does get
rewritten to a build-time path (reproducing the bug), and that the
worker+shared assets land byte-identical in the output dir with `setWorkerUrl`
resolving to the correct emitted filename.
- A real headless-Chromium test (Playwright) constructing an actual module
`Worker` from the copied files — it evaluates cleanly with the sibling file
present, and errors without it, closing the loop on what jest/type-check alone
can't catch.
- Full plugin test suites (40 files / 486 tests) and pre-commit, all green.
```
npx jest superset-frontend/plugins/plugin-chart-point-cluster-map
```
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
**Note:** this fixes the worker-loading half of what #42608 was
investigating. The second half — `preset-chart-deckgl` also resolving the wrong
(root, 6.x) maplibre-gl copy at runtime via the hoisted
`@vis.gl/react-maplibre`, instead of its own pinned 5.x-compatible copy — is
still unresolved. npm `overrides` genuinely cannot fix it (confirmed via three
separate override strategies; this is a known npm limitation with
peer-dependency-mediated resolution, npm/rfcs#552). That needs either
`patch-package` or re-pinning `preset-chart-deckgl` off maplibre-gl 6 entirely
— a call for a human, tracked separately.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]