Hacker News new | ask | show | jobs
by crabmusket 720 days ago
Imagine if you could just scp your source code tree onto a CDN and it would automatically bundle it based on how clients import it.
2 comments

This sounds similar to https://esm.sh/
Unfortunately singleton peer dependencies (like react) are quite complicated with esm.sh. When esm.sh rewrites a module to import react from the cdn, it kinda "decides" which version of react is it at the moment the module is built on the CDN for the first time. That's why react is "special" and gets a stable build in esm.sh (essentially pointing to a fixed version no matter which version you specify): to avoid the dreaded "two copies of react" error.
Yep definitely. There are a few of these like JSPM that help convert libraries into browser-importable URLs.
Isn't this the idea behind CI/CD wotkflows?
Yes, the difference is I'd like to offload the work of having to think about optimising code delivery.