-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
feat(optimizer): support patch-package #10286
Conversation
@@ -1076,6 +1083,20 @@ export function getDepHash(config: ResolvedConfig, ssr: boolean): string { | |||
return getHash(content) | |||
} | |||
|
|||
function getPatchesLastModificationTime(dir: string): string | undefined { | |||
const fullPath = path.join(dir, 'patches') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel we better not make this convention hard-coded, as this is customizable with --patch-dir
option of patch-package. Maybe we could have a better way to detect it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything a part from YAO or a (maybe expensive) grep for searching files ending with .patch
I think this would be a good addition. For reference, a side from
|
Thanks for the pointers. I updated the PR to take this into account and limit the number of fs calls for lockfile != yarn. |
This looks really useful! Thanks a lot, @ArnaudBarre. Let's merge it so we can test it during the alpha. |
'pnpm-lock.yaml', | ||
'bun.lockb' | ||
{ name: 'package-lock.json', patchesDirs: ['patches'] }, // Default of https://github.com/ds300/patch-package | ||
{ name: 'yarn.lock', patchesDirs: ['patches', '.yarn/patches'] }, // .yarn/patches for v2+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be changed by the user but either way it's part of the lockfile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the report, I didn't notice while I was testing. I will send a PR to fix this before the release
Description
patch-package is a widely used tool to quickly fix node modules. And I would love Vite to invalidate dependencies pre-bundling when I add/update a patch to the project.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).