Open brandonroberts opened 3 months ago
Indeed, glob doesn't seem to be supported for server.deps.inline
.
Vite uses createFilter
utility https://github.com/vitejs/vite/blob/ec16a5efc04d8ab50301d184c20e7bd0c8d8f6a2/packages/vite/src/node/ssr/ssrExternal.ts#L38-L41 to support glob, but Vitest (vite-node) has a different logic to match patterns
https://github.com/vitest-dev/vitest/blob/f969fb0f9f0247a7daa2afee8f70de25ea5e123f/packages/vite-node/src/externalize.ts#L157-L162
I created a repro with simpler dependencies https://github.com/hi-ogawa/reproductions/tree/main/vitest-5911-deps-inline-glob
Thanks @hi-ogawa. I can work on a PR to support this behavior if that's whats recommended
vite-node processes ssr.noExternal
on resolved file paths, Vite processes it on bare imports, so we cannot apply the same filter.
vite-node processes
ssr.noExternal
on resolved file paths, Vite processes it on bare imports, so we cannot apply the same filter.
Ok. What would be the recommended approach with globs?
Ok. What would be the recommended approach with globs?
If I knew what to do with this, we would've already implemented it 😞
I don't know how to solve these, they were always resolved differently in Vite and Vitest. Vite can also resolve monorepo packages while Vitest expects that the package is in moduleDirectories
and the name and the folder are the same.
If it's fine to keep this difference, we can just apply the glob with the same rule - svelte/*
will be equal to node_modules/svelte/.+
Thanks @sheremet-va. I think it's fine to keep this difference, and note that globs are not expected to be inlined also
Describe the bug
The docs state that anything in the
ssr.noExternal
array in the Vite config is automatically added to thetest.server.deps.inline
array.Globs do not seem to be supported.
Repo: https://github.com/eduardoRoth/analog-ionic-capacitor-template
Reproduction
npm i
@ionic/angular
from thetest.server.deps.inline
array.@ionic/**
is already in thessr.noExternal
array.npx ng test
ssr.noExternal
array@ionic/angular
npx ng test
System Info
Used Package Manager
npm
Validations