-
-
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
Jest unable to resolve node_modules at the root in Yarn workspace #5325
Comments
Can you provide a reproduction repo? |
Possibly, but not immediately. |
After looking at the error again. Jest seemed like able to resolve it but didn't transform the module. |
Related to #5108. The difference in my case is they are 3rd party packages - redux-form, lodash-es, etc. And they're not symlinked. They're hoisted up by yarn workspaces. Just to test it out I manually symlinked .babelrc from my package folder to each of these 3rd party module and it worked. |
My workaround:
And run it once via |
I'm not convinced that symlinking everything is the right solution to what is definitely a real issue. It might be worth reopening this. |
I agree, that shouldn't be necessary |
We will need a reproduction repo, though |
Full reproduction and steps here: https://github.com/kcjonson/jest-hoisting-bug-demo |
Webpack isn't running babel on your packages. You need to add your packages path to the babel step in your webpack config. |
Here is a workaround that i found.
in my case, the package folders are right under the root workspace. If you put the packages under the package folder, you might need to change to |
I have the same issue and I can't find a workaround |
Having this issue as well |
none of the above mentioned fix this... and I still can not find a workaround :'( |
Okay, I somehow find my way to work around this, there are server tiny caveats: |
Can anyone out together a reproduction? The repo from @kcjonson should be fixed in RN 0.59 due to facebook/react-native#22972 You shouldn't need to do |
change import from |
@SimenB I did a reproduction repo. You can find it here jest-resolve-issue |
Any news on this? |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
I solved this by using moduleNameMapper: {
'@fta/components-token': '<rootDir>../token/src',
}, or |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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. |
Jest v22.1.1
To enhance lerna in my project I have enabled yarn workspaces. Since then
transformIgnorePatterns
does not seem to be able to resolve node_modules at the root.The same jest config used before switching to yarn workspace:
This causes
Unexpected token import
error.Is there workaround or proper configuration for allowing jest to play nice in yarn workspaces?
Thanks.
The text was updated successfully, but these errors were encountered: