Skip to content

fix: treat all optimizeDeps.entries values as globs #20045

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jamesopstad
Copy link
Contributor

Description

This fixes an issue introduced in #15853 that meant globs containing \\ could be treated as literals rather than globs. This would then lead the filesystem check here -

fs.existsSync(entry),
- to fail because the path would include \. It also improves upon the previous approach because entries explicitly including node_modules can now be used alongside other glob entries.

These changes mean that explicitly passing entries containing the environment's build output directory no longer work. It's not clear why this feature was introduced but if it would be considered breaking to remove it then I can add in the extra handling.

@jamesopstad jamesopstad changed the title Treat all optimizeDeps.entries as globs Treat all optimizeDeps.entries values as globs May 15, 2025
@jamesopstad jamesopstad changed the title Treat all optimizeDeps.entries values as globs fix: treat all optimizeDeps.entries values as globs May 15, 2025
@Jinjiang
Copy link
Contributor

For more information, I've created a reproduction of #15853 originally trying to solve:
https://github.com/Jinjiang/reproductions/tree/vite-entries-in-node_modules-20250516

From what I've tested it works as expected.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants