-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
SyntaxError: Unexpected token export when running tests for library that imports lodash-es #6282
Comments
#812 (comment) worked for me.
By the way, |
Unfortunately I've tried that and it's still not working. Any idea why this could be? Thanks for the info, at this point I can't remove lodash as I'm migrating and it's used in too many places but good to know. |
Thanks for reporting this! Unfortunately, this is not an issue with Nx and it's not actionable for us. Please note the best place for this would be StackOverflow or the Nrwl Community Slack or the Jest repo if you think it is an actual bug on their side. As mentioned in this thread, this same issue has been widely discussed in #812, where a lot of information can be found and recommended solutions. You can also check this issue on the ts-jest repo. |
hi @leosvelperez - thanks for the helpful links! In terms of actions that Nx could take to rectify this common pitfall, could the required config be added to the template generated by |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
On a newly generated Nx project (React), after generating a library and importing lodash-es in its component, when trying to run the tests I get the error:
Expected Behavior
The tests should pass.
Steps to Reproduce
npx create-nx-workspace@latest lodash-problem
and select Reactnx generate @nrwl/react:library --name=test --directory=ui --style=none --linter=eslint --unitTestRunner=jest --tags=type:ui --publishable --buildable --importPath=@lodash-problem/ui-test --component --strict --pascalCaseFiles --no-interactive
//UiTest.tsx
npm i lodash-es --save
nx affected:test
Environment
Node : 16.4.2
OS : darwin x64
npm : 7.18.1
nx : Not Found
@nrwl/angular : Not Found
@nrwl/cli : 12.5.7
@nrwl/cypress : 12.5.7
@nrwl/devkit : 12.5.7
@nrwl/eslint-plugin-nx : 12.5.7
@nrwl/express : Not Found
@nrwl/jest : 12.5.7
@nrwl/linter : 12.5.7
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : 12.5.7
@nrwl/schematics : Not Found
@nrwl/tao : 12.5.7
@nrwl/web : 12.5.7
@nrwl/workspace : 12.5.7
@nrwl/storybook : 12.5.7
@nrwl/gatsby : Not Found
typescript : 4.2.4
I've tried all the solutions mentioned here #812 and none have worked.
The text was updated successfully, but these errors were encountered: