Closed harveylee closed 1 year ago
I have a piece of code in a vitest test like:
import { something } from '~/fileA' // ...and later const module = await import('~/foo/bar/fileB')
And in my tsconfig.json, something like:
tsconfig.json
{ "compilerOptions": { "baseUrl": "./src", "paths": { "~/*": ["./*"] } } }
(i.e. I create an alias ~ for the src directory)
~
src
Using vitest 0.25.5, both the static import (fileA) and the dynamic import (fileB) work.
Using vitest 0.25.6, the static import works but the dynamic import fails. [vite-node] Failed to load ~/foo/bar/fileB
[vite-node] Failed to load ~/foo/bar/fileB
Here is the commit in vitest 0.25.6 that I think gives rise to this issue? https://github.com/vitest-dev/vitest/pull/2461 https://github.com/vitest-dev/vitest/commit/e9cb4136
This seems like a Vitest bug.
I have a piece of code in a vitest test like:
And in my
tsconfig.json
, something like:(i.e. I create an alias
~
for thesrc
directory)Using vitest 0.25.5, both the static import (fileA) and the dynamic import (fileB) work.
Using vitest 0.25.6, the static import works but the dynamic import fails.
[vite-node] Failed to load ~/foo/bar/fileB
Here is the commit in vitest 0.25.6 that I think gives rise to this issue? https://github.com/vitest-dev/vitest/pull/2461 https://github.com/vitest-dev/vitest/commit/e9cb4136