-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Dynamic import not working if using .babelrc #2442
Comments
Even using babel on package.json jest is failing if I try to use |
I've tried this boilerplate: https://github.com/cloud-walker/frontend-boilerplate, changed Looks like "env": {
"test": {
"plugins": [
"babel-plugin-dynamic-import-node"
]
}
} Make sure you run jest with |
Just encountered this issue from using The workaround above works, but is this perhaps something to be added to the documentation? Thanks. |
It's mentioned at the bottom here: https://facebook.github.io/jest/docs/en/webpack.html#using-with-webpack-2 |
I tried using env + react + stage-0 presets and "babel-plugin-dynamic-import-node". |
Would be nice to have in a section that's agnostic to Webpack versions. I wouldn't have read through the Webpack 2 docs cause I'm on Webpack 4. Thanks for pointing to it though! |
I made it work by using the
|
In case this helps anyone else: My tests were failing in CI but not locally the reason for this being that the NODE_ENV was set to production in the Dockerfile. The .babelrc env property is matched against the BABEL_ENV environment variable. Failing that it uses NODE_ENV. Jest will set NODE_ENV to "test" if it is null! Therefore because it was production it wouldn't set it to test and babel would not run the transform. Joy. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm trying to use this: https://github.com/tc39/proposal-dynamic-import on my experimental boilerplate.
All is working fine if I move babel configuration to the
package.json
:The same exact configuration give the following error if the babel config is on its own
.babelrc
file:I've node
7.3
, latestyarn
and latestjest
on OSXThe text was updated successfully, but these errors were encountered: