Skip to content

glob import doesn't search under node_modules #6370

@marklai1998

Description

@marklai1998

Describe the bug

A lot of npm packages support loading different locales on the fly(like dayjs)

But when do import.meta.glob('/node_modules/some-package/locale/*.js will return empty object

So now I need to move all the locale js outside node_modules, which causes a lot of lining issue

It seems like someone actively disabled it
8b3d0ea

But I don't think it's the intended behaviour, ref: #1985 (comment)

Doc also doesn't specify this behaviour

System Info

System:
    OS: macOS 11.2.3
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 127.06 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
    Yarn: 1.22.11 - /usr/local/bin/yarn
    npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm
  Browsers:
    Chrome: 96.0.4664.110
    Safari: 14.0.3
  npmPackages:
    @vitejs/plugin-react: 1.1.3 => 1.1.3 
    vite: 2.7.10 => 2.7.10

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions