Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glob import doesn't search under node_modules #6370

Closed
7 tasks done
marklai1998 opened this issue Jan 4, 2022 · 8 comments
Closed
7 tasks done

glob import doesn't search under node_modules #6370

marklai1998 opened this issue Jan 4, 2022 · 8 comments

Comments

@marklai1998
Copy link

marklai1998 commented Jan 4, 2022

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

@ygj6
Copy link
Member

ygj6 commented Jan 4, 2022

duplicate of #1903

@marklai1998
Copy link
Author

marklai1998 commented Jan 4, 2022

duplicate of #1903

Not true, #1903 uses ../../node_modules and can still get the result
But now both ../../node_modules / /node_modules wont work, return no result at all

#1903 is form 6 Feb 2021 and the changes 8b3d0ea is made at 11 Feb 2021

@ygj6
Copy link
Member

ygj6 commented Jan 4, 2022

OK, I will investigate further and submit a PR if possible

@ygj6
Copy link
Member

ygj6 commented Jan 4, 2022

Would you like to provide a minimal reproduction to help us reproduce it better?

@marklai1998
Copy link
Author

Would you like to provide a minimal reproduction to help us reproduce it better?

https://stackblitz.com/edit/vite-ynvvon
here you go, thanks a lot

@ygj6
Copy link
Member

ygj6 commented Jan 13, 2022

I think this PR #6056 fixes this issue.

@pecliu
Copy link

pecliu commented Feb 15, 2022

Would you like to provide a minimal reproduction to help us reproduce it better?

https://stackblitz.com/edit/vite-ynvvon here you go, thanks a lot

seems that the problem is still there, on [email protected]

@bluwy
Copy link
Member

bluwy commented Feb 19, 2022

Seems to be working for me for Vite 2.8.2 and above. Closing as fixed by #6056. @pecliu Please provide a repro if this still happens for you in the latest version. Thanks!

@bluwy bluwy closed this as completed Feb 19, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants