Open antfu opened 3 years ago
I think it should still work by setting a relative path to node_modules. Are you using a virtual import pattern? An example would be nice :)
The import for unplugin-icons
uses something like import Icon from '~icons/logos/nuxt-icon'
, which in the original behavior it will always prepend with ../
and got this error:
See https://github.com/antfu/unplugin-icons/pull/63 for the implementation.
This other case I can think about might be importing from some libraries, like: import Button from 'element-ui/lib/button'
As for the windows path resolution, I guess since the isAbsolute
can only be provided by hooks, we can leave the responsibility to the module author?
I'm mostly hesitating to see if we really need another component option or can actually fix the situation by default. For resolving ~
, for instance we can check prefix to disable resolution on virtual and ~
, @
.
This other case I can think about might be importing from some libraries, like: import Button from 'element-ui/lib/button'
This case makes sense. But maybe with a flag like resolvePath: false
?
One more point, we usually allow inherit options from dirOptions
(apply option to a group of scanned components) (https://github.com/antfu/unplugin-icons/pull/63#discussion_r709546061)
Do you mean we rename isAbsolute
to resolvePath
?
Yes please, and also auto-enable the flag when ~
, @
prefixes was provided if possible :)
Sorry guys I don't want to disturb you here but I guess this is stale for a long time. Will this get updated?
Actually, I am waiting for this PR https://github.com/antfu/unplugin-icons/pull/63
Regards.
Still waiting too.
This would allow libraries to provide absolute import paths (from library submodules, or virtual modules) using the
components:extend
hook. In my case, I am integrating withunplugin-icons
.