Skip to content

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

@Cellule

Description

@Cellule

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions