Skip to content

How to bundled URL import "esm.sh/..." like any other normal imports? #20014

Answered by rschristian
PTPhongKMF asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you'll need to use a plugin to swap out the import specifiers for the CDN content (which you can simply use fetch to get).

It's not the most minimal example, but we do something like this to power Preact's REPL on our doc site. It's not much code, and is fairly well-documented, so it might be of use to reference: https://github.com/preactjs/preact-www/blob/d5e1eac9bae7d5f23fa071d0063851b7d4accd7b/src/components/controllers/repl/repl.worker.js#L85-L131

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PTPhongKMF
Comment options

Answer selected by PTPhongKMF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants