-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Tests fail when using es module dependencies #3001
Comments
From what I understand, this happens because Jest doesn't do Babel transforms on any node_modules (as configured here). And because Node doesn't support ES modules yet, it causes syntax error. Not sure about the fix. The only idea I can come up with is to add popular libraries that are ES modules (are there others apart from lodash-es?) to the regex pattern (maybe like this). |
We realize this is sub-optimal, and hope Node adds official support for ES Modules soon. This should make things easier, but not immediately. The most appropriate answer I can give you currently is to not use You'd be better off requiring just the bits you need [from In the current state of the ecosystem, Node and webpack considered, packages should be shipped as For packages who wish to ship a ES Modules build of their module, they should ship them in addition to their In the future, packages may be able to define an |
Thanks @Timer |
Is this a bug report?
Yes
Can you also reproduce the problem with npm 4.x?
N/A (but yes)
Which terms did you search for in User Guide?
test, lodash, es module
Environment
node -v
: v8.4.0npm -v
: 5.3.0yarn --version
: 0.27.5npm ls react-scripts
: 1.0.10Steps to Reproduce
lodash-es
import { flatten } from 'lodash-es';
npm test
Expected Behavior
Test passes.
Actual Behavior
Test fails due to ES module syntax in
lodash-es
causing a syntax error.Reproducible Demo
https://github.com/Pumpuli/cra-esdeps/
The text was updated successfully, but these errors were encountered: