fix: treat all optimizeDeps.entries values as globs#20045
fix: treat all optimizeDeps.entries values as globs#20045sapphi-red merged 3 commits intovitejs:mainfrom
optimizeDeps.entries values as globs#20045Conversation
optimizeDeps.entries as globsoptimizeDeps.entries values as globs
optimizeDeps.entries values as globsoptimizeDeps.entries values as globs
|
For more information, I've created a reproduction of #15853 originally trying to solve: From what I've tested it works as expected. Thanks. |
sapphi-red
left a comment
There was a problem hiding this comment.
optimizeDeps.entries: ['**/node_modules/foo/**', '!**/bar/**'] will match /project/node_modules/foo/bar/somefile.js, but probably not a big deal.
|
Is there anything blocking merging this? It's currently blocking remix-run/react-router#13570, which is preventing some users using React Router with the Cloudflare Vite plugin. Thanks. |
patak-cat
left a comment
There was a problem hiding this comment.
optimizeDeps.entries: ['/node_modules/foo/', '!/bar/'] will match /project/node_modules/foo/bar/somefile.js, but probably not a big deal.
Agree with you here. I don't think users will hit this edge case.
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 -vite/packages/vite/src/node/optimizer/scan.ts
Line 281 in 8679a43
\. It also improves upon the previous approach because entries explicitly includingnode_modulescan 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.