Vite ?raw imports file not found
Open
Nobody has claimed this yet.
t¹ 🐞 bug
t⁸ ⋅ triage
- Dominant language
- JavaScript
- Stars
- 26.3k
- Forks
- 1.8k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 20
Description
Rollup Version
3.20.4
Operating System (or Browser)
WSL 2
Node Version (if applicable)
18.13.0
Link To Reproduction
Expected Behaviour
No error
Actual Behaviour
[!] Error: Could not load /project/node_modules/stuff/plus.svg?raw (im
ported by src/components/Icon.svelte): ENOENT: no such file or directory, open '/project/node_modules/stuff/plus.svg?raw'
Removing the ?raw part lets rollup find the file but that obviously changes the behaviour of the program.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Rollup REPL reproduction and the import from src/components/Icon.svelte that requests example.svg?raw. Run the reproduction and trace the file lookup for the query-suffixed path. Done means the SVG is found without an ENOENT error and the ?raw behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100