-
-
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
Add enzyme/webpack entrypoint with getPluginsForInstalledReact function #895
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { IgnorePlugin } from 'webpack'; | ||
|
||
import { REACT013, REACT155 } from './version'; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export function getPluginsForInstalledReact() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have any future plans for any other exports from this entry point, such that this shouldn't be the default export? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not really, i made it a named export to make the name of the function clarify what it does |
||
const plugins = []; | ||
|
||
/* | ||
this list of conditional IgnorePlugins mirrors the conditional | ||
requires in src/react-compat.js | ||
*/ | ||
|
||
if (!REACT013) { | ||
plugins.push(new IgnorePlugin(/react\/lib\/ExecutionEnvironment/)); | ||
plugins.push(new IgnorePlugin(/react\/lib\/ReactContext/)); | ||
plugins.push(new IgnorePlugin(/react\/addons/)); | ||
} | ||
if (REACT013) { | ||
plugins.push(new IgnorePlugin(/react-dom/)); | ||
} | ||
if (REACT013 || REACT155) { | ||
plugins.push(new IgnorePlugin(/react-addons-test-utils/)); | ||
} | ||
if (!REACT155) { | ||
plugins.push(new IgnorePlugin(/react-test-renderer/)); | ||
plugins.push(new IgnorePlugin(/react-dom\/test-utils/)); | ||
plugins.push(new IgnorePlugin(/create-react-class/)); | ||
} | ||
|
||
return plugins; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./build/webpack'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this means we have yet another implicit dependency :-/
Theoretically it's a safe one, if someone's importing the "webpack" entry point they're likely to have webpack available, but there's no way to declare version compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know :(
Another concern is that we'd be introducing a new API that we must remove once we release the rewrite with adapters...