Replies: 3 comments 1 reply
-
I'm not sure what the problem you're trying to solve is. Are you trying to factor out the path from your import map urls? I don't believe you can do that. |
Beta Was this translation helpful? Give feedback.
-
I had a similar issue recently and discovered that esm.sh now has a
So in your import map use a trailing slash: {
"imports": {
"react-icons/": "https://esm.sh/react-icons@4.4.0?alias=react:preact/compat&deps=react&path=/",
}
} and then your imports will be exactly as they were for Node. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
I am creating a Fresh project. I wanted to use react-icons and found a working solution — you need to import https://esm.sh/react-icons@4.4.0/?alias=react:preact/compat&deps=react.
Furthermore, I've decided to use an import map like this instead of pasting this long https://esm.sh link everywhere:
"icons": "https://esm.sh/react-icons@4.4.0/?alias=react:preact/compat&deps=react"
It works, but to actually use any icons, you would need to do something like this (how it is done in Node):
import { FaBeer } from 'react-icons/fa';
With the https://esm.sh link you would need to import it like this:
https://esm.sh/react-icons@4.4.0/fa?alias=react:preact/compat&deps=react.
How do I import the necessary submodule with the import map instead of doing this:
Beta Was this translation helpful? Give feedback.
All reactions