Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

nfcampos
Copy link
Collaborator

Motivation

  • make using enzyme with webpack easier
  • make sure the documentation in the webpack guide doesn't go out of date

Changes

  • export getPluginsForInstalledReact function
  • update our karma config to use it
  • update documentation guides to use it

getPluginsForInstalledReact is currently tested with webpack 1 and all supported versions of react because it is used in our karma tests

closes #881 #740 #744 #847 #309 #791

ljharb
ljharb previously approved these changes Apr 13, 2017
@@ -0,0 +1,33 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { IgnorePlugin } from 'webpack';
Copy link
Member

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.

Copy link
Collaborator Author

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...

import { REACT013, REACT155 } from './version';

// eslint-disable-next-line import/prefer-default-export
export function getPluginsForInstalledReact() {
Copy link
Member

Choose a reason for hiding this comment

The 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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

@nfcampos nfcampos force-pushed the webpack-get-plugins branch from 6a63cdd to 8550011 Compare April 15, 2017 11:57
@nfcampos
Copy link
Collaborator Author

@aweary @blainekasten @lelandrichardson id like to have one more opinion before merging this, if any of you guys have time to take a look it'd be great :)

nfcampos added 3 commits May 18, 2017 18:56
- export getPluginsForInstalledReact function
- update our karma config to use it
- update documentation guides to use it
@nfcampos nfcampos force-pushed the webpack-get-plugins branch from 97a63d9 to 926c2c2 Compare May 18, 2017 17:56
@nfcampos
Copy link
Collaborator Author

should I close this now @ljharb ?

@ljharb
Copy link
Member

ljharb commented Jun 26, 2017

We'll probably still want to incorporate it once #1007 lands.

@nfcampos
Copy link
Collaborator Author

but after #1007 we will have no need for custom webpack configs i hope, no?

@ljharb
Copy link
Member

ljharb commented Jun 26, 2017

ah that's true :-)

Yeah, let's close this, but make sure to revisit just in case after the next major.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose function that returns list of IgnorePlugins needed for using enzyme with webpack
2 participants