Closed robintown closed 4 hours ago
This is a known issue of Vite SSR as we replace static import with dynamic import and needs await on promise. Duplicate of https://github.com/vitest-dev/vitest/issues/5122
Node doesn't support such dynamic import either https://stackblitz.com/edit/vitest-dev-vitest-xmakvp?file=repro.js, so I would imagine then
export needs to be avoided in general.
Describe the bug
If one of the modules in your project has an exported function named
then
, Vitest will call this function when loading the module. This can either cause your tests to fail or cause Vitest to hang, depending on whether the function returns or throws.Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-qfykda?file=src%2Fbasic.ts
System Info
Used Package Manager
pnpm
Validations