Skip to content

switch from unpkg to jsdelivr #1244

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

Closed
wants to merge 2 commits into from
Closed

switch from unpkg to jsdelivr #1244

wants to merge 2 commits into from

Conversation

Rich-Harris
Copy link
Member

This replaces unpkg.com with jsdelivr.com, which is actively maintained and seems somewhat more robust (I've been experiencing a lot of issues with unpkg recently and I'm apparently not alone).

At least in local testing, jsDelivr also seems faster. However:

  1. jsDelivr doesn't resolve directory imports. This means that a file like this...
export * from './components';

...doesn't work, because it should be ./components/index.js. Personally I'm not too concerned about this — packages should contain valid imports.

  1. More concerningly, it doesn't always successfully resolve entry points. It can resolve svelte but not svelte/legacy, for example — it doesn't appear to handle pkg.exports correctly. Appending /+esm to pathnames results in a 200 response, but not one we can use (it bundles stuff in a way that would break things).

Copy link

vercel bot commented Apr 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
svelte-dev ✅ Ready (Inspect) Visit Preview Apr 1, 2025 0:58am

@Rich-Harris
Copy link
Member Author

Actually I take back point 2, we can use the same mechanism we currently use (fetching the package.json and resolving from that). So it's only really the directory imports, which we can choose to solve or not. If we choose to solve it, we can use the jsDelivr API.

I think there might be a better alternative though — PR incoming

@Rich-Harris
Copy link
Member Author

closing in favour of #1248

@Rich-Harris Rich-Harris closed this Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant