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 |
jsumners-nr
left a comment
There was a problem hiding this comment.
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.resolveuntil aHookis created, which avoids an issue where Vite can bundle the module into an ESM context whererequireis unavailable (vitejs/vite#19403).