-
-
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
Use webpack IgnorePlugin instead of externals #791
Conversation
The documentation describes that optional dependencies should be marked as externals in webpack. This means that they will still show up in the source map. The new setup simply ignores them, which is more correct. This was already reflected by Enzyme's own karma webpack configuration. The React 0.14 ignore list was also written as a webpack config for consistency.
Thanks for the PR! @remcohaszing have you verified that this setup works with Webpack 1/2 in all our supported versions of React? |
I didn't test it with older versions of React, but I don't see why it wouldn't work. The old docs stated:
By labeling them as "external" they're not really ignored, just undefined. Now they truly are ignored. |
/* webpack.config.js */ | ||
// ... | ||
plugins: [ | ||
new webpack.IgnorePlugin(/cheerio/), |
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.
why do we need to ignore cheerio
and react-dom/server
? our own karma.conf.js
seems to work ok without ignoring these
// ... | ||
plugins: [ | ||
new webpack.IgnorePlugin(/cheerio/), | ||
new webpack.IgnorePlugin(/react-dom/), |
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 believe this list of ignore plugins is actually for react 13 not 14, they're swapped for some reason?
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 just converted the list to a list of webpack.IgnorePlugin
instances. If the list is wrong, I'd say that's unrelated to this patch. I've only used react 0.15, so I don't know what should be ignored exactly.
I don't think this is relevant any more now that we're on v3. |
The documentation describes that optional dependencies should be marked as externals in webpack. This means that they will still show up in the source map.
The new setup simply ignores them, which is more correct. This was already reflected by Enzyme's own karma webpack configuration.
The React 0.14 ignore list was also written as a webpack config for consistency.