Giter Site home page Giter Site logo

Comments (6)

hi-ogawa avatar hi-ogawa commented on August 24, 2024

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

for (const ex of patterns) {
if (typeof ex === 'string') {
if (moduleDirectories.some(dir => id.includes(join(dir, ex)))) {
return true
}
}

I created a repro with simpler dependencies https://github.com/hi-ogawa/reproductions/tree/main/vitest-5911-deps-inline-glob

from vitest.

brandonroberts avatar brandonroberts commented on August 24, 2024

Thanks @hi-ogawa. I can work on a PR to support this behavior if that's whats recommended

from vitest.

sheremet-va avatar sheremet-va commented on August 24, 2024

vite-node processes ssr.noExternal on resolved file paths, Vite processes it on bare imports, so we cannot apply the same filter.

from vitest.

brandonroberts avatar brandonroberts commented on August 24, 2024

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?

from vitest.

sheremet-va avatar sheremet-va commented on August 24, 2024

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/.+

from vitest.

brandonroberts avatar brandonroberts commented on August 24, 2024

Thanks @sheremet-va. I think it's fine to keep this difference, and note that globs are not expected to be inlined also

from vitest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.