esm-dev/esm.sh

The "deps" query parameter is not honored fully deep

Opened this issue · 0 comments

My development project is built on react@18.3.1 and also requires react-bootstrap@2.10.4. However, upon using the following esm.sh endpoint in my project, I ended up with two conflicting version of react loaded in the browser (18.3.1 and 18.2.0):

https://esm.sh/react-bootstrap@2.10.4?deps=react@18.3.1

I drilled down into the dependency tree to find the conflict. Here's the direct line trace:

https://esm.sh/react-bootstrap@2.10.4?deps=react@18.3.1 -> https://esm.sh/v135/@restart/ui@1.6.9/es2022/Anchor.js -> https://esm.sh/v135/@restart/hooks@0.4.16/es2022/hooks.mjs -> https://esm.sh/stable/react@18.2.0/es2022/react.mjs

You can see that once you are 3 import chains deep, it's pulling in react@18.2.0 instead of 18.3.1.

I ended up resolving this by pinning the version of restart/ui to the prior version: https://esm.sh/react-bootstrap@2.10.4?deps=react@18.3.1,@restart/ui@1.6.8. Despite the workaround, I figured I'd let you know.