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

use same esm version for dependencies

Open schlichtanders opened this issue 2 years ago • 7 comments

Failing module

when accessing https://esm.sh/v64/@mui/[email protected]?alias=react:preact/compat,react-dom:preact/compat,react/jsx-runtime:preact/jsx-runtime&[email protected]&target=es2020 and recursively looking into the imports, you will find that the preact is imported from esm.sh/stable instead of esm.sh/v64

This is crucial, as esm.sh unfortunately introduces new bugs (I have one right which I cannot minify yet but it is not occuring where I cached esm.sh resources and is occuring where I cleared the cache)

To reliable pin an esm version, using the same version for dependencies is essential.

schlichtanders avatar Apr 25 '23 12:04 schlichtanders

For UI libraries like React and Vue, esm.sh uses a special build version stable to ensure single version of the library is used in the whole application.

i think this actions as expected.

ije avatar Apr 25 '23 16:04 ije

yes, I like that all can refer to the same version, however it is suboptimal that one always need to rely on the latest esm.sh version. (as there is always only one "stable", i.e. the latest)

Currently the new version of "stable" completely broke my setup and I moved away from esm.sh as a consequence.

schlichtanders avatar Apr 25 '23 17:04 schlichtanders

sorry for the break change, let me make it clear, the stable means we locked the import path, you still can specify different version of these packages. eg:

https://esm.sh/react -> https://esm.sh/react@latest -> https://esm.sh/[email protected] -> https://esm.sh/stable/[email protected]

https://esm.sh/react@17 -> https://esm.sh/[email protected] -> https://esm.sh/stable/[email protected]

ije avatar Apr 25 '23 17:04 ije

yes, I fixed it to preact 10.6.6 like seen above, which was not enough to prevent the break

hence the issue, as it would be great to also pin these react/preact combos to a specific esm.sh version like esm.sh/v66

schlichtanders avatar Apr 26 '23 06:04 schlichtanders

It is a year back, and I am thinking about going back to esm.sh, but find that the dependencies for preact and similar cannot be pinned. This is crucial, as apparently esm.sh introduced bugs back then and I want to prevent such breaking change on esm.sh side to crash my whole application.

Is there any further work on making dependencies like react/preact also pinnable?

schlichtanders avatar Mar 20 '24 15:03 schlichtanders

in next build, build version like 'v135' or 'stable' will be removed. no pin needed then.

ije avatar Mar 20 '24 21:03 ije

Sounds like @ije is cooking! Let him cook 🔥

renhiyama avatar Mar 21 '24 17:03 renhiyama