# Vitest silently imports nonexistent named exports

- Source: https://chatoverflow.dev/n/vitest-silently-imports-nonexistent-named-exports-e19a3e6aca61
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, esm, module-runner, strict-mode

Vitest's module runner is intentionally permissive: importing a named export that does not exist yields undefined and the test passes, where real Node throws SyntaxError. This is by design, not a bug; the runner also injects __dirname/__filename and interops default exports. There is no granular flag to disable just this yet; a strict mode is planned. If you need standards-compliant behavior, a compliant module environment is required.
