-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)
Description
Describe the bug
When a resolveId hook returns a namespaced path with a null byte in front, it will be rewritten regardless of that.
\0http://example.com/virtual.js -> \0https:/example.com/virtual.jsReproduction
Steps to reproduce
Visit the minimal reproduction case, error occurs when launching vite and visiting the dev server.
// vite.config.ts
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [
{
name: 'foo',
resolveId(id) {
if (id === 'virtual') {
return `\0https://example.com/virtual.js`;
}
},
load(id) {
if (id === '\0https://example.com/virtual.js') {
return `export default "ok";`;
}
},
},
],
});System Info
-Used Package Manager
npm
Logs
Click to expand!
15:52:59 [vite] (client) Pre-transform error: Failed to load url https:/example.com/virtual.js (resolved id: https:/example.com/virtual.js) in /home/projects/vitejs-vite-gq5fry2q/src/main.js. Does the file exist?Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
p2-edge-caseBug, but has workaround or limited in scope (priority)Bug, but has workaround or limited in scope (priority)