esm-dev / esm.sh

A fast, smart, & global CDN for modern(es2015+) web development.
https://esm.sh
MIT License
2.95k stars 143 forks source link

@observablehq/plot prototypes are missing a method due to skipped side effects #808

Closed mootari closed 3 months ago

mootari commented 4 months ago

Failing module

Error

Classes in the bundle served by esm.sh are missing a method because a module import side effect isn't applied.

Correct JSDelivr ESM import:

(await import("https://cdn.jsdelivr.net/npm/@observablehq/plot@0.6.13/+esm")).Mark.prototype.plot

esm.sh import with missing method:

(await import("https://esm.sh/@observablehq/plot@0.6.13")).Mark.prototype.plot

The library mutates the prototype as a side effect in one of its core modules: https://github.com/observablehq/plot/blob/28c7ebc55a4fd78b4ef264f658ce9109c7c94eaa/src/plot.js#L375

Additional info