It seems that the issue here was that resolveId is being called before buildStart, when a node_modules/.vite cache doesn't exist.
Further investigation revealed that we can't wait for buildStart because it causes the build to lock up. We're also unable to cache the viteResolve function, as the result seems to change as the build progresses.
The fix involves just creating a new viteResolve function on every call to resolveId. This may cause a slight degradation in performance, but it doesn't seem noticeable to me.
This fixes issue #31.
It seems that the issue here was that
resolveId
is being called beforebuildStart
, when anode_modules/.vite
cache doesn't exist.Further investigation revealed that we can't wait for
buildStart
because it causes the build to lock up. We're also unable to cache theviteResolve
function, as the result seems to change as the build progresses.The fix involves just creating a new
viteResolve
function on every call toresolveId
. This may cause a slight degradation in performance, but it doesn't seem noticeable to me.