-
Notifications
You must be signed in to change notification settings - Fork 395
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
Cannot read property 'locale' of null for @lingui/loader
#642
Comments
Unfortunatelly I can't test it on Windows. Let me know what you've found 👍 |
So it seems the js-lingui/packages/cli/src/api/catalog.ts Line 390 in 24d521f
There is even a long-standing PR in minimatch that probably fixes it along with linked open issues. I also found It's rather silly that even in 2020 we are still unable to solve this stupid problem in some universal way. I am not that well oriented in NodeJS-verse so I am not sure what are alternatives to |
I have found micromatch which seems to be the successor that actually works. And now I am freaking out because snapshot testing is a huge problem here. All tests are failing for me because of wrong path separators in snapshots :/ |
If you know that the snapshots are correct, just accept them and yolo. I’ve checked appveyor which runs tests on windows and the tests pass there. Feel free to push even unfinished pr, I’m gonna check it in the morning. Cheers 👍
…On 11 Apr 2020, 23:24 +0200, Daniel K. ***@***.***>, wrote:
I have found micromatch which seems to be the successor that actually works.
And now I am freaking out because snapshot testing is a huge problem here. All tests are failing for me because of wrong path separators in snapshots :/
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Fixed in #643 |
I still get this issue with 3.0.0-11. I checked that _getCatalogForFile is null for me (on Windows). |
@panuhorsmalahti Can you try to provide a reproduction repo? It works fine for me (also on Windows). Perhaps you have found a different edge case there. |
Yeah, it seems to be a different issue. The catalog glob in the function is a different path from the file: And the catalog location for me seems to be default: https://github.com/lingui/js-lingui/blob/next/packages/conf/src/index.ts#L43 EDIT: Got it fixed with this catalog config:
|
It doesn't work if you use |
Hm with latest versión, should work properly with rootdir, create a new issue if you find this not working properly |
Yes on latest version. It's an easy test too if you're using @lingui/loader; just prepend your catalog paths with |
Alright, I'll take a look then |
Martijn could you tell me the differences to see the error in our example of create-react-app? We are using in catalog paths, and @lingui/loader in |
The project with React https://github.com/lingui/js-lingui/tree/main/examples/create-react-app (examples) does not work. Here is the error in screenshot. Tested on January 30, 2021. The Lingui project has a lot of bugs, to this day even with version 3.4.0, extraction does not work well, compilation does not work well either, production interpolation always returns the name of the variable {var} and the loader (@lingui/loader) returns "TypeError: Cannot read property 'locale' of null". In development mode, the interpolation works well, but when going to production nothing works as expected. There have been many problems related to these contexts, I've gone through the issues a bit but so far (Jan 30, 2021) none of this is fixed. |
Haha :) I'll conclude with your super useful commentary about Lingui... That Lingui with 150.000 DOWNLOADS MONTHLY, used by the biggest companies and maintained and created for FREE, probably "LINGUI PROBLEMS" are just your problems. Don't be a shame for the community and do something useful for it. Thanks 👍🏻 ps: a screenshot about create-react-app example with a fresh installation and doing yarn start: |
Does it make sense that it works in some people and not in others? My intention was not to shock you, I'm part of the community myself but just to make you understand that the project works in some people and not in others and it's not normal. If you need a specific configuration, you have to mark it somewhere. For the create-react-app project, I followed the README "yarn install - yarn start" and the page to display this error, I didn't do anything else. Try the version in the "examples" folder. |
A lot of projects work for some people and not for others, its normal because programs are made by humans that makes mistakes. We try to keep Lingui as much as maintained as we can, practically we release a new version each tuesday. Sincerely i would like to all projects being as good maintained as Lingui is. About your issue, I think in the next version is fixed(Next tuesday), because we did a minor change to resolve catalogs for snowpack plugin and Will resolve the issue Also for webpack |
@semoal Yes you didn't lie but the default actions of lingui if I may say so, are extraction (yarn extract) and compilation (yarn compile). It's different actions must be universal for all users, if a yarn extract works for one user and not for another it's not the same dependency. It was just constructive criticism to get the team to look at the problems and fixes. It's still used by big companies as you say. Peace! |
Hi folks! :) I see that the issue is closed, but I'm observing the exact same behavior reported by @msixc . To reproduce it:
(my Am I missing some step @semoal ? |
I open a new issue, since this one is closed. |
Describe the bug
App crashes when using
@lingui/loader
To Reproduce
Install deps and run example of
create-react-app
fromnext
branch.Expected behavior
It should work :)
Additional context
![image](https://user-images.githubusercontent.com/1096340/79052362-4e2ef580-7c36-11ea-9e14-d9bd15691e4d.png)
It's coming from this line. Apparently the
getCatalogForFile
returnsnull
for some reason. I will investigate it further, but I suspect it's a classic issue of wrong path separators (I am on Windows).js-lingui/packages/loader/src/index.js
Line 41 in 24d521f
lingui --version
: 3.0.0-10The text was updated successfully, but these errors were encountered: