Plugin dependency requirements break testing abilities
Paratron opened this issue · 1 comments
When I try to install the plugin into our Next.js 11.1 project, I run into serious problems because of the dependency requirements of the plugin.
When I start up my next dev server, I get this message:
[preact] Missing/incorrect dependencies.
Please run:
npm i react@npm:@preact/compat react-dom@npm:@preact/compat
or:
yarn add react@npm:@preact/compat react-dom@npm:@preact/compat
So far so good - the problem is, when I completely override the react
and react-dom
dependencies in npm, the next.js build itself works just fine, but it breaks all unit tests in jest either using react-test-renderer
or enzyme-adapter-react-16
. The problem is that those testing libs try to access features inside the libaries which are not contained in preact/compat (for example react-dom/test-utils
).
Is it really necessary to alias the react and react-dom modules "globally" for the whole project?
Any chance you have a reproduction? I think we're just missing an alias here, though I'm not a Next or Jest user myself.