Skip to content

Query params to customize icons add the .svelte suffix in markup in Svelte 5 #408

@PetrLaskevic

Description

@PetrLaskevic

Describe the bug

<script lang="ts">
    import FolderIcon from "virtual:icons/material-symbols/files?width=24px&height=24px";
</script>
<FolderIcon></FolderIcon>

The result of npm run dev:

The interesting portion is height="24px.svelte" The suffix should not be there.

[plugin:vite:import-analysis] Failed to parse source for import analysis because the content contains invalid JS syntax. If you are using JSX, make sure to name the file with the .jsx or .tsx extension.
~icons/material-symbols/files:1:307
1  |  <script>const{...p}=$props()</script><svg viewBox="0 0 24 24" width="24px" height="24px.svelte"  {...p}><path fill="currentColor" d="M4 20q-.825 0-1.412-.587T2 18v-3h9q.825 0 1.413-.587T13 13V4h7q.825 0 1.413.588T22 6v12q0 .825-.587 1.413T20 20zm-2-6V8q0-.825.588-1.412T4 6h6zm3.825-1L11 7.825V13z"/></svg>
   |                                                                                                                                                                                                                                                                                                                    ^

Please tell me if I should post any more config files (tsconfig.json, svelte.config.js, vite.config.js etc).
The whole repo if you want to see any config files.

Reproduction

See snippet I provided.

System Info

System:
    OS: Linux 6.8 Linux Mint 22 (Wilma)
    CPU: (16) x64 AMD Ryzen 7 5700U with Radeon Graphics
    Memory: 2.52 GB / 13.51 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 22.16.0 - ~/.nvm/versions/node/v22.16.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.16.0/bin/npm
    pnpm: 10.10.0 - ~/.nvm/versions/node/v22.16.0/bin/pnpm
  Browsers:
    Chromium: 138.0.7204.168

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions