Skip to content

"Error: require() of ES Module" while unit testing with vitest and react-resting library #156

@ganesh31

Description

@ganesh31

Getting the below error when rendering the speedometer component during unit testing

Error: require() of ES Module /node_modules/.pnpm/[email protected]/node_modules/lodash-es/isNumber.js from /node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/react-d3-speedometer/dist/core/util/index.js not supported.
Instead change the require of isNumber.js in /node_modules/.pnpm/[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/react-d3-speedometer/dist/core/util/index.js to a dynamic import() which is available in all CommonJS modules.
Serialized Error: {
"code": "ERR_REQUIRE_ESM",
}

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