Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unpkg and jsdelivr fields to package.json #384

Merged
merged 1 commit into from Jun 7, 2019

Conversation

tmcw
Copy link
Contributor

@tmcw tmcw commented Jun 7, 2019

Immer already has a UMD build, which is great! This PR adds jsdelivr and unpkg fields in package.json pointing to the same place, so jsdelivr.com and unpkg.com respectively can automatically serve the right files, and AMD implementations that depend on one or both of those (like d3-require) can automatically load immer directly or as a dependency.

@aleclarson
Copy link
Member

Hey thanks! I wonder why they don't support umd:main?

@aleclarson
Copy link
Member

Note: You can always use https://bundle.run/immer instead

@tmcw
Copy link
Contributor Author

tmcw commented Jun 7, 2019

There's a lot of bundle history so I might be missing something, but as far as I can tell, microbundle coined umd:main, and unpkg predates it by quite a while, as does jsdelivr. Surprisingly nobody's asked about umd:main on the unpkg issue tracker, but also notably microbundle switched to recommending the unpkg field. Like the rest of JavaScript modules, it's… chaotic.

Yep, though bundle.run works, it’s a bigger piece of infrastructure to maintain than the NPM CDNs, so it’s often slow or crashed.

@aleclarson
Copy link
Member

Cool, thanks for the insight!

@aleclarson
Copy link
Member

aleclarson commented Jun 7, 2019

Maybe umd:main and jsdelivr should be removed since Microbundle recommends (and of course, Unpkg supports) the unpkg field?

@tmcw
Copy link
Contributor Author

tmcw commented Jun 7, 2019

I think getting rid of umd:main should be fine because no consumers use it, but I think jsdelivr should stay because sadly they don't support the unpkg field - see Tips for Module Authors on this page.

@aleclarson
Copy link
Member

aleclarson commented Jun 7, 2019

@jimaek Yo, can you weigh in here? Can we agree on unpkg being the standard?

Q: Why can't jsDelivr et al look for an existing .umd.js to use before loading package.json.

@aleclarson
Copy link
Member

aleclarson commented Jun 7, 2019

Oh, the jsDelivr server isn't open source, so I don't see why we should cater to them.

@aleclarson
Copy link
Member

How ubiquitous is jsDelivr?

@aleclarson
Copy link
Member

Meh, I've overblown this. I'm just gonna merge. 😂

@aleclarson aleclarson merged commit fa1f5e6 into immerjs:master Jun 7, 2019
@aleclarson
Copy link
Member

🎉 This PR is included in version 3.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants