abhinaba-ghosh / cypress-react-selector

:zap: cypress plugin to locate react elements by component, props and state
https://www.cypress.io/
MIT License
274 stars 28 forks source link

Error when using Vite preprocessor due to require.resolve #444

Open Cellule opened 8 months ago

Cellule commented 8 months ago

require.resolve is only supported by webpack. When trying to migrate to Vite preprocessor with cypress-vite I hit error that require doesn't exists. https://github.com/abhinaba-ghosh/cypress-react-selector/blob/1c552942900f9ce24bf93a5ca996392957ac461f/src/resqInjector.js#L8-L11

I initially tried to add typeof require !== "undefined" but vite transforms it making the check useless. I'm not sure what is a good solution, for now on my side I simply patched away the require.resolve call and use the hardcoded path