Open ainsleyclark opened 9 months ago
This fix worked for me: https://github.com/unplugin/unplugin-icons/issues/128#issuecomment-1545549162
That still didn't work for me unfortunately:
app.d.ts
:
// Unplugin icons
import type * as Icons from 'unplugin-icons/types/svelte';
export default Icons;
I'm running into this as well. Things are set up correctly, the icons are working, but WebStorm is giving me the Cannot resolve directory ~icons
error as well.
However, npm run check
(svelte-kit sync && svelte-check --tsconfig ./tsconfig.json
) doesn't produce any errors, and when I CMD+click the import statement (e.g. "~icons/mi/external-link"
) it takes me to node_modules/unplugin-icons/types/svelte4.d.ts
which shows:
declare module 'virtual:icons/*' {
import { SvelteComponent } from 'svelte'
import type { SvelteHTMLElements } from 'svelte/elements'
export default class extends SvelteComponent<SvelteHTMLElements['svg']> {}
}
declare module '~icons/*' {
import { SvelteComponent } from 'svelte'
import type { SvelteHTMLElements } from 'svelte/elements'
export default class extends SvelteComponent<SvelteHTMLElements['svg']> {}
}
Describe the bug
By cloning the repo, and opening the
sveltekit
example folder within an IDE. The type defs are brokwn, see attached screenshot. This is also not working on a project of mine with the same error and unsure why the types are not resolving.Cannot resolve directory 'virtual:icons'
Reproduction
Repo - /examples/sveltekit
System Info
Used Package Manager
npm
Validations