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

Specify external dependencies of dependencies

Open philippkuehn opened this issue 2 years ago • 4 comments

It would be nice if the deps parameter would also work for dependencies of dependencies.

For example I want to specify a version of @tiptap/core. Within @tiptap/starter-kit some other packages are loaded, e.g. @tiptap/extension-blockquote. @tiptap/extension-blockquote also depends on @tiptap/core but esm.sh loads a different version of it (2.0.0-beta.99). Setting deps on @tiptap/starter-kit doesn’t help unfortunately.

Can be tested with this html file.

<!doctype html>
<head>
  <meta charset="utf-8">
</head>
<body>
  <div class="element"></div>
  <script type="module">
    import { Editor } from 'https://esm.sh/@tiptap/[email protected]'
    import StarterKit from 'https://esm.sh/@tiptap/starter-kit?deps=@tiptap/[email protected]'
    
    const editor = new Editor({
      element: document.querySelector('.element'),
      extensions: [
        StarterKit,
      ],
      content: '<p>Your content.</p>',
    })
  </script>
</body>
</html>

philippkuehn avatar Sep 21 '21 19:09 philippkuehn

@philippkuehn i think this is a bug, i will fix this, thanks 🙏

ije avatar Sep 21 '21 19:09 ije

Any update?

its-me-ilia avatar Feb 03 '22 16:02 its-me-ilia

Encountering this for packages that rely on React (I'm trying to force everything to use [email protected]).

ysulyma avatar May 06 '22 23:05 ysulyma

@ije this makes esm.sh unusable for packages that transitively depend on React or THREE, which have to be globally unique. For example @react-three/fiber imports react-use-measure which imports [email protected] (the latest version is 18.1.0).

ysulyma avatar May 15 '22 03:05 ysulyma