-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
fix: stop considering parent URLs as public file #11145
Conversation
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
I think it'll be great to have tests that can reproduce this. I'm not sure how this would happen in Vite currently, and maybe it's better to fix the root problem. |
👍 Makes sense. I will try to reproduce this as a test. |
Just had a closer look.
It happens when you have this: import.meta.glob('/../path/to/**/*.js') Which is a valid pattern:
I think it requires a full-fledged playground (because |
That's quite a strange pattern to support. I'd ping Anthony but he's on vacation now. I'm not sure if we want to correctly support it though, and using relative |
Virtual modules cannot use Hydrogen introduced the practice of globbing inside When using pnpm, the file paths ends up being |
It looks like these paths are indeed valid. Interesting that this is the only place where things break though. If vite-ecosystem-ci passes, this LGTM. |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
Description
Currently, when the URL starts with
/.../node_modules/
(e.g./../node_modules/some-library/src/someFile.js
) thencheckPublicFile()
wrongfully considers the file to be a public file.This bug happens because
path.join(publicDir, '/../node_modules/some-library/src/someFile.js')
resolves to the actual filesomeFile.js
which makescheckPublicFile()
wrongfully believe that it's a public file.Additional context
This sometimes happens for frameworks built on top of vite-plugin-ssr.
Reproduction: https://github.com/brillout/vite-reprod-11145.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).