Closed Malien closed 7 months ago
Just stumbled upon this as well. As a workaround i have to use a simple console.log
in the meantime.
Interesting — I just ran a quick trace on this and it seems the hijack for load
doesn’t work on custom virtual modules. The result of this line is null
:
https://github.com/antfu/vite-plugin-inspect/blob/main/src/node/hijack.ts#L104
The virtual module content not added to the recorder since the rollup filter is returning false: we need to apply the filter in resolveId
hook, the filter should be applied to the original id and not to the resolved id.
Playground working after updating to latest 0.8.4 release: https://stackblitz.com/edit/vitejs-vite-qu7ibm?file=package.json,vite.config.js
Describe the bug
I have a custom loader that intercepts funky-looking import specifiers, ala:
import foo from "prefix:some-argument"
.vite.config.js
As per rollup convention:
But the transform stack of such virtual modules are empty (aka. I cannot see the result of a
load
step)Reproduction
https://stackblitz.com/edit/vitejs-vite-g5udhe?file=custom-loader.mjs
System Info
Used Package Manager
pnpm
Validations