Skip to content
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

Possible Mismatch between babel and swc output #2156

Open
timofei-iatsenko opened this issue Jan 24, 2025 · 0 comments
Open

Possible Mismatch between babel and swc output #2156

timofei-iatsenko opened this issue Jan 24, 2025 · 0 comments

Comments

@timofei-iatsenko
Copy link
Collaborator

It seems there is a mismatch between SWC and Babel's plugins behaviours, i quote the posts from Discord discussion

Has anyone encountered a discrepancy with the Lingui number placeholders (e.g., {0}, {1}, {2})

For example I am seeing this locally
{2, plural, one {Do X for {0}} other {Do Y for {1}}}

But I see that it is looking for this on my deployed environment, notice the mismatch
{0, plural, one {Do X for {1}} other {Do Y for {2}}}

The code snippet

<Plural
  one={`Add # item ${amount} to ${name || ''}`}
  other={`Add # items ${amount} to ${name || ''}`}
  value={items?.length || 0}
/>

Was fixed by changing the snippet to

<Plural
  one={`Add # item ${amount} to ${name}`}
  other={`Add # items ${amount} to ${name}`}
  value={itemsCount}
/>

We use swc for local, I need to check if we switched from babel to swc on prod
Ya I believe prod is babel, so this is likely the culprit, its the only thing different

Need to confirm and prepare a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant