Publish UMD bundles for public CDNs
geotrev opened this issue · comments
Hello!
I'm working on a project and noticed I'm unable to use a Snabbdom UMD bundle via one of the several free CDNs available, such as unpkg or jsdelivr. It seems that today UMD bundles aren't published. In the past a dist
folder provided this but it's since been removed.
I found some comments in 2020 that indicating removing UMD bundles was beneficial to keep the build clean, but I don't think that's necessarily the case. UMD bundles are relatively straightforward and you can easily specify which methods (perhaps not all) are added to the global snabbdom
namespace with a separate entry file.
If this seems reasonable I'm happy to take a stab at a rollup config (have done this in a few projects already, myself) and tie it to the version/publish process (probably a preversion
or prepublishOnly
npm script to build them automatically so it doesn't go out of date like mightyiam has indicated was a problem previously).
Thanks for considering :)
As a quick exercise, the change could be as simple as this:
I would be open to a PR that adds the relevant config to rollup and the build, but I will not have the dist
folder pollute the git repo. If the UMD modules need to be commited to the repo then I'd say no
Sure. It could be ignored from git and published to npm only. Thanks
It's time to embrace esm fully
This works today, as-is without any wonky build steps or legacy module wrapping formats:
<script type="module">
import * as snabbdom from 'https://cdn.skypack.dev/snabbdom'
</script>
Thanks @mreinstein! My use-case is pretty small and your example will actually work much better than what I was trying to do anyway. 😁
Cheers
glad it worked out!