Skip to content

Virtual modules ending in *.svg fail to load #19914

Open
@Fuzzyma

Description

@Fuzzyma

Describe the bug

I am using a vite plugin to add a virtual module. Just by chance, since its generating an svg, I ended its name in *.svg. This worked fine in vite v5 but fails after upgrading to vite v6. The server seems to resolve the svg differently and cant find in.
Renaming the ending immediately solves this problem.

Reproduction

https://stackblitz.com/edit/vitejs-vite-ecxwyqxf?file=src%2Fmain.js

Steps to reproduce

  • load the reproduction and see it not working
  • rename both occurrences of the virtual module to not end in *.svg
  • see a rectangle appear

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (16) x64 AMD Ryzen 7 PRO 6850HS with Radeon Graphics
    Memory: 12.45 GB / 15.28 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    Yarn: 3.3.0 - ~/.nvm/versions/node/v22.14.0/bin/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
    pnpm: 10.4.1 - ~/.local/share/pnpm/pnpm
    bun: 1.2.3 - ~/.bun/bin/bun
  Browsers:
    Chrome: 134.0.6998.88

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: devdev serverp2-edge-caseBug, but has workaround or limited in scope (priority)regressionThe issue only appears after a new release

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions