Closed microdou closed 5 months ago
Start a new pull request in StackBlitz Codeflow.
It seems a problem with SvelteKit and the ids, notice the double ??
:
resolveId {
id: '~icons/mdi/alarm-off??raw&width=4em&height=4em',
normalizedId: '/~icons/mdi/alarm-off??raw&width=4em&height=4em',
res: '~icons/mdi/alarm-off???raw&width=4em&height=4em',
query: { '?raw': '', width: '4em', height: '4em' }
}
resolveId {
id: '~icons/mdi/alarm-off??raw&width=1em&height=1em',
normalizedId: '/~icons/mdi/alarm-off??raw&width=1em&height=1em',
res: '~icons/mdi/alarm-off???raw&width=1em&height=1em',
query: { '?raw': '', width: '1em', height: '1em' }
}
when generating the components (raw):
generateComponent {
collection: 'mdi',
icon: 'alarm-off',
query: { '?raw': '', width: '4em', height: '4em.svelte' },
compiler: 'svelte'
}
generateComponent {
collection: 'mdi',
icon: 'alarm-off',
query: { '?raw': '', width: '1em', height: '1em.svelte' },
compiler: 'svelte'
}
and then the error since we're adding ?=raw
in the svg:
There is a bug in when splitting the query params...
Describe the bug
Importing icon with
?raw
in SvelteKit results in error. This bug appears since version 0.17.4.To reproduce: Go to the official unplugin-icons SvelteKit playground, which immediately produces error:
Commenting out the affected
?raw
imports removes the error.Possible cause: A change introduced in version 0.17.4 likely caused the issue. https://github.com/unplugin/unplugin-icons/compare/v0.17.3...v0.17.4#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80
Reproduction
https://stackblitz.com/fork/github/unplugin/unplugin-icons/tree/main/examples/sveltekit
System Info
Used Package Manager
npm
Validations