-
Notifications
You must be signed in to change notification settings - Fork 1.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
Jest unexpected token import #416
Comments
@jbernardo95 Hey, that's strange because jest recommends using Could this be related to? - jestjs/jest#3129 |
Maybe I didn't express myself correctly. With the generated But If change the generated The problem with this is that my
So my suggestion is to leave the the But I am not sure if there are any special reasons to have the configurations at the What do you think ? |
Ahh I see @jbernardo95 Basically, the reason why it's moved out to I see that there is bit of duplication there but given that's how env specific configuration works it's not too bad 😄 If you get any ideas that might fix this, please feel free to share it here 👍 |
I will document this in README for now. |
@gauravtiwari Got it ! Well I understand the move to But don't think this is correct. From my understanding Of course A way to fix this would be to move these configurations to the loaders which is more generic but adds code duplication or to wrap the current
I personally prefer them in the loaders, even thought they are repeated. But again if the objective of the gem is to support only those frameworks, the current implementation is fine. Tell me what you think. And correct me if I am wrong :) |
I am also using Jest and have a special test env config in my |
Have you seen this: http://facebook.github.io/jest/docs/webpack.html#using-with-webpack-2 ? Our .babelrc looks like this:
|
@p0wl Thank you very much for the info, I had no idea webpack 2 had native support for ES modules. I guess this justifies it, because jest will be kind of an exception. @gauravtiwari Will close the issue. |
@jbernardo95 I'm running into this issue and having a hard time interpreting this solution. Is the recommendation here to add a custom test env in |
I'm not familiarised with this anymore, but I believe @p0wl's comment has the solution. Take a look at: http://facebook.github.io/jest/docs/en/webpack.html#using-with-webpack-2 |
Adding
as suggested by @jbernardo95
For me. On to the next adventure! |
Hi !
I just upgraded one of my applications to webpacker 2.0 and everything went smoothly until I reached the part of running my frontend tests.
I was getting a
unexpected token import
when running jest due to the fact the theenv
config in.babelrc
disables module transformation"modules": false
.To go around this I had to set a specific config in
.babelrc
just for thetest
environment.I was wondering if it is possible to move all the
env
configuration to theconfig/webpack/loaders/babel.js
? Similar to this:I would be happy to open a PR if this makes sense :)
Thanks !
The text was updated successfully, but these errors were encountered: