-
Notifications
You must be signed in to change notification settings - Fork 386
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
@lingui/loader with webpack 5 and jest #999
Labels
Comments
semoal
pushed a commit
that referenced
this issue
Mar 14, 2021
Released on 3.7.2. Thanks for reporting this issue mate. |
Wow, that's awesome, thanks! 👍 |
This was referenced Mar 16, 2021
@samsaggace I don't suppose that you can share your jest transform that uses @lingui/loader. I'm facing the same problem. |
So sorry, I don't have access to this codebase anymore (I changed company) and don't really remember what I did 😅 |
Pity, thanks for the reply though. Take care. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! 👋
Firstly, thanks for your work on this project! 🙂
I use
@lingui/loader
to dynamically generate the js locales from the po and created a transformer in jest to use the loader (instead of webpack).It was working fine with webpack 4 but when trying to migrate to webpack 5, I have an issue with my unit tests failing with:
From what I see in the source code of the loader, there is specific code when running inside webpack 5 context that fails because in my case, I've installed webpack 5 but I'm not currently running it ( in the context of the unit tests), so
this._compilation
is not defined.I used patch-package to patch
@lingui/loader@3.6.0
for the project I'm working on.Here is the diff that solved my problem:
I don't know if it's the correct way to solve my problem as I found very little documentation about how to use the loader in the context of unit tests with jest, so please any feedback is welcome !
Thanks for your help
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: