Open trusktr opened 8 months ago
I got the example mostly working without code transformations using
importmap
*
in front of all package names?raw
option for all URLshttps://codepen.io/trusktr/pen/YzBOqpq/50658233b7a3430b9cad10fe34baca41?editors=1000
Now there are no more runtime errors, but some of the editor examples are still not working quite right. 🤔
UPDATE: looks like in that last example esm.sh still does some code transformations for some files. For example, I see it loads files from @lume/element
minified (and maybe broken).
I can't get it to work perfectly like the local example because I can't get the code to be fully raw.
I highly recommend making esm.sh
by default not transform any code, no minfication, no bundling, no anything, just plain raw code as-is with importmaps (the best vanilla ESM CDN), and let people opt into optimizations that might break things.
Better if everything just works out of the box.
As of now, esm.sh by default has many many issues due to all the things it does out of the box, and this is a high maintanenance burden that does not seem fixable any time soon.
Web developers need an ESM CDN that works perfectly out of the box (even if that's not the most optimized possible). The best way to do that is serving their code as-is.
Here's a live example:
https://codepen.io/trusktr/pen/WNPgwNZ/bbce4b6d555ab200054bed163ad6e0a7?editors=1000
The error:
I'm familiar with the error, but it seems like the code transformation is changing something to be not what it should be.
This example works fine locally where the only difference is that the
import
at the top of the HTML is importing local vanilla ES Modules (and the top of the HTML also has a neededimportmap
):https://github.com/lume/live-code/blob/bbef27fe581d9a29e769c93e26ad7fcd8c05df64/examples/index.html#L53
Other than that, its all the same code with the main difference being that the pen is importing transformed code from esm.sh.