testing-library/react-hooks-testing-library

Critical dependency: the request of a dependency is an expression

UladzKha opened this issue · 5 comments

After installation and some unit test for my custom hook I receive this error message after run application.
I've tried to reinstall all packages, remove node_modules ... didn't work. Does anybody havve an idea how it can be fixed ?

./node_modules/@testing-library/react-hooks/lib/pure.js 39:4-17
Critical dependency: the request of a dependency is an expression

Please provide a reproduction of your issue.

Same issue here.

Are you trying to bundle your code (webpack, rollup, whatever)? I suspect the error is coming from this line where we try to load the renderer from a variable, but the bundler doesn't know how tor resolve that.

If this is the case, the solution is to change your import to a specific renderer, e.g. '@testing-library/react-hooks -> @testing-library/react-hooks/dom (assuming you are testing for a browser environment but alternative options can be found here).

This worked. Thanks for the reply.

Closing due to inactivity from the original poster