Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

vite8.0.0-beta.1 Image cross-domain #550

@bpuns

Description

@bpuns

Describe the bug

In Vite 7, I was able to directly cross-domain access an image under the "src" directory and it worked fine. However, in Vite 8, this is no longer possible.

Even if I set server.cors to true, it still won't work.

Reproduction

https://stackblitz.com/edit/vitejs-vite-guzdkutc?file=src%2Fmain.js,package.json,test.html&terminal=dev

Steps to reproduce

  1. Create the project using the command "pnpm create vue"
  2. Upgrade to vite 8.0.0-beta.1
  3. Place a 404.png image under the "src" directory.
  4. Start the service by running "pnpm run dev"
  5. Create another HTTP service, and then create an HTML file.
<img src="http://localhost:5173/src/404.png" />

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 21.11 GB / 39.81 GB
  Binaries:
    Node: 22.18.0 - C:\Users\bpuns\AppData\Local\fnm_multishells\9088_1765350416428\node.EXE
    npm: 10.9.3 - C:\Users\bpuns\AppData\Local\fnm_multishells\9088_1765350416428\npm.CMD
    pnpm: 10.4.1 - C:\Users\bpuns\AppData\Local\fnm_multishells\9088_1765350416428\pnpm.CMD
  Browsers:
    Chrome: 143.0.7499.41
    Edge: Chromium (140.0.3485.66)

Used Package Manager

pnpm

Logs

Cross-origin requests must be made with CORS mode enabled.

Validations

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions