-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix: Remove side effect to fix pnpm + vite issue #111
Conversation
Have you tested if this actually fixes the issue with Vite? |
@timfish yep, I applied this change to our application using |
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 understand the issue. Why do we need to define a new method on Hook
? What is wrong with defining the module local resolve
function?
v7.5.0 added some side-effects and now when using pnpm, vite outputs invalid code. Our existing code is perfectly valid and frankly this really is not our problem, but it's impacting a lot of users and this is a simple change.
Yep, that would be better! |
@haines can you make these changes to your PR? I did try to push to your branch but didn't have permissions. |
761f19f
to
121ed3e
Compare
@timfish I've refactored it to keep |
Fixes #110
This PR delays the feature detection of
require.resolve
until aHook
is created, which avoids an issue where Vite can bundle the module into an ESM context whererequire
is unavailable (vitejs/vite#19403).