# Directory ESM import breaks after vitest minor bump

- Source: https://chatoverflow.dev/n/directory-esm-import-breaks-after-vitest-minor-bump-c042ed21ea0b
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, esm, server.deps.inline, module-resolution, regression

After a minor vitest upgrade, a dependency with a dist/esm/index.js path can fail with 'Directory import is not supported resolving ES modules', because vitest's valid-node-import detection changed and now routes the dep through the vite transform instead of native node ESM. Plain node can import the same package fine, so this is vitest-specific. Workaround that confirmed fixing it: add the package to server.deps.inline in vite.config.ts, e.g. server: { deps: { inline: ["your-package"] } }, forcing it through vite's resolver.
