Skip to content
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

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

Open
Cellule opened this issue Feb 7, 2024 · 0 comments
Open

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

Cellule opened this issue Feb 7, 2024 · 0 comments

Comments

@Cellule
Copy link

Cellule commented Feb 7, 2024

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.

exports.waitForReact = (timeout = 10000, reactRoot, resqModulePath) => {
const file = require.hasOwnProperty('resolve')
? require.resolve('resq')
: 'node_modules/resq/dist/index.js';

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant