Skip to content

Webpack tries to bundle react-addons-test-utils when it is not needed #968

@donaldpipowitch

Description

@donaldpipowitch

I use the newest version of enzyme, react-dom and react-test-renderer and I shouldn't need react-addons-test-utils anymore. But it looks like enzyme still requires react-addons-test-utils in webpack projects.

ERROR in ./~/enzyme/build/react-compat.js
Module not found: Error: Can't resolve 'react-addons-test-utils' in '/Users/foo/bar/node_modules/enzyme/build'
 @ ./~/enzyme/build/react-compat.js 143:20-54

I think it comes from this try/catch-block. It looks like requireing react-dom/test-utils and/or react-test-renderer/shallow fail while bundling (or: they are bundled at build time and something fails inside this try/catch at runtime), so it tries to get react-addons-test-utils. Or does webpack try to bundled things inside a catch by default?

A special handling for react-addons-test-utils in webpack projects currently isn't mentioned in the docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions