-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
Combining preact and with-jest examples results in production build error #1545
Comments
I figured out that setting |
OK, I don't think there's a good solution to this on your end. I worked around it by moving I'll close this, but I recommend documenting somewhere that even tests should not be placed in the |
Maybe better to keep issue open in that case :) |
Example: I've updated the with-jest example to also include preact to reproduce this issue.
Essentially, react-test-renderer relies on a private file in react that isn't present in preact. When bundling for production, that file obviously isn't present. However, there's no point in bundling anything in a
__tests__
folder as none of that will get served in production.This used to work fine in 2.0.0-beta.41, but I think the 2 webpack commits in 2.0.0-beta.42 exposed the fact that the
__tests__
directories are being included in the loaders when bundling for production. I was usingconfig.externals
in mynext.config.js
, but I think the new chunk plugin addition isn't respecting that option somehow. If this can be resolved through webpack config, I would welcome any suggestions.I think one solution would be to exclude directories matching
/\/(?:__)?test/
or something in the default webpack config in next.js.The text was updated successfully, but these errors were encountered: