-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Webpack tries to bundle react-addons-test-utils
when it is not needed
#968
Comments
react-addons-test-utils
when it is not needed
It looks like it works, if
|
Seems like we may need to update the docs? |
FWIW, yes. Webpack is pretty aggressive about bundling everything it thinks you need. It doesn't care what language construct the require statement is in; if it sees it, it's going to bundle the package. |
FYI these are the warnings I get when running a simple test with console.error node_modules/fbjs/lib/warning.js:36
Warning: ReactTestUtils has been moved to react-dom/test-utils. Update references to remove this warning.
console.error node_modules/fbjs/lib/warning.js:36
Warning: Shallow renderer has been moved to react-test-renderer/shallow. Update references to remove this warning. #968 (comment) didn't help in my case.
PS: Attempting to run enzyme on |
Note that React 16 doesn't exist yet; and alphas are not supported. |
@thiagodebastos try removing |
With
edit: My bad. It was from my test :) |
Looks like the solution is documented here: https://github.com/airbnb/enzyme/blob/master/docs/guides/webpack.md#react-15-compatibility |
I use the newest version of
enzyme
,react-dom
andreact-test-renderer
and I shouldn't needreact-addons-test-utils
anymore. But it looks likeenzyme
still requiresreact-addons-test-utils
in webpack projects.I think it comes from this
try/catch
-block. It looks likerequire
ingreact-dom/test-utils
and/orreact-test-renderer/shallow
fail while bundling (or: they are bundled at build time and something fails inside thistry/catch
at runtime), so it tries to getreact-addons-test-utils
. Or does webpack try to bundled things inside acatch
by default?A special handling for
react-addons-test-utils
in webpack projects currently isn't mentioned in the docs.The text was updated successfully, but these errors were encountered: