esm.sh
esm.sh copied to clipboard
esm is building modules with importing `node:preact` instead of `npm:preact`
For reference, node:<pkg>
is only allowed to load native node modules and not third party modules. However, https://esm.sh/*[email protected]?target=node&bundle
-> https://esm.sh/v111/[email protected]/X-ZS8q/node/preact-render-to-string.bundle.js
has imports as node:preact
. Same is happening with other packages like when using *swr
(notice that * for external deps) and it targets node:react
. I hope esm.sh can fix this "bug" :)
As far as I can remember deno should fail to import these too as deno itself also uses npm prefix to import packages from npm.
in deno, you need to add "preact" to your import maps for the *preact-render-to-string
pattern:
{
"imports": {
"preact-render-to-string": "https://esm.sh/*[email protected]",
"preact": "https://esm.sh/preact"
}
}
i saw you are using the "node" target, where the "node:preact" come from?
I'm working on an experimental URL imports feature that downloads the files just like deno does and then imports them.
So if I'm not wrong, deno adds node:<pkg name>
to their module name resolution if there's <pkg name>
in import map? Let me know if this is the intended way so I can make changes to act the same way.
But as far as I'm aware, you shouldn't be using node:<pkg name>
as they're reserved for native node modules and not third party npm packages 😅
If possible, please use npm:<pkg name>
instead of node:<pkg name>
for better consistency.
so can I close this? thanks
Did u fix it? If yes, then you can close it