plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
17.08k stars 1.87k forks source link

fix require path to resource in node_modules #7146

Closed birkskyum closed 2 months ago

birkskyum commented 2 months ago

Fix #7145

Instead of providing the relative path to the node_modules, let the runtime resolve it.

It's a bit speculative, but it's easy to imagine setups (different package managers, monorepos) that doesn't have the maplibre-gl node module located exactly in the location specified:

@archmoj I don't have a repro of the error, and thus haven't been able to validate the patch. Also, I'm trying to wrap my head around why it's at all necessary for the users of a plotly.js distribution to resolve this path, because I expected webpack to have done so already when the plotly.js bundles are created.

Update: it's not using a pre-build dist, because of this https://github.com/plotly/plotly.js/blob/8b7805da75a01181d31a15468fb4b51959e650e6/package.json#L6

birkskyum commented 2 months ago

@archmoj , I have found in a reproduction that:

archmoj commented 2 months ago

Nicely done. Thanks very much for the fix. :dancer: