esm.sh icon indicating copy to clipboard operation
esm.sh copied to clipboard

Deps argument is not used by some subdependencies

Open oscarotero opened this issue 10 months ago • 0 comments

I have the following script, with React 19 as dependency: https://esm.sh/@radix-ui/[email protected]

/* esm.sh - @radix-ui/[email protected] */
import "/stable/[email protected]/es2022/react.mjs";
import "/v135/@radix-ui/[email protected]/es2022/react-compose-refs.mjs";
import "/stable/[email protected]/es2022/jsx-runtime.js";
export * from "/v135/@radix-ui/[email protected]/es2022/react-slot.mjs";

I can configure it to use React 18 using the deps variable: https://esm.sh/@radix-ui/[email protected][email protected]

/* esm.sh - @radix-ui/[email protected] */
import "/stable/[email protected]/es2022/react.mjs";
import "/v135/@radix-ui/[email protected]/es2022/react-compose-refs.mjs";
import "/stable/[email protected]/es2022/jsx-runtime.js";
export * from "/v135/@radix-ui/[email protected]/X-ZC9yZWFjdEAxOC4zLjE/es2022/react-slot.mjs";

But after opening the second import (/v135/@radix-ui/[email protected]/es2022/react-compose-refs.mjs) I can see it uses React 19

/* esm.sh - esbuild bundle(@radix-ui/[email protected]) es2022 production */
import*as f from"/stable/[email protected]/es2022/react.mjs";function l(n,o){if(typeof n=="function")return n(o);n!=null&&(n.current=o)}function i(...n){return o=>{let u=!1,c=n.map(t=>{let e=l(t,o);return!u&&typeof e=="function"&&(u=!0),e});if(u)return()=>{for(let t=0;t<c.length;t++){let e=c[t];typeof e=="function"?e():l(n[t],null)}}}}function s(...n){return f.useCallback(i(...n),n)}export{i as composeRefs,s as useComposedRefs};
//# sourceMappingURL=react-compose-refs.mjs.map

Interestingly the latest export (/v135/@radix-ui/[email protected]/es2022/react-slot.mjs) does keep my configuration and with [email protected] the path is different. (/v135/@radix-ui/[email protected]/X-ZC9yZWFjdEAxOC4zLjE/es2022/react-slot.mjs) and it does import React 18 correctly.

oscarotero avatar Jan 08 '25 17:01 oscarotero