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

babel-plugin-makepot: "translations is not iterable" #43793

Closed
jeremyfelt opened this issue Sep 1, 2022 · 4 comments · Fixed by #43797
Closed

babel-plugin-makepot: "translations is not iterable" #43793

jeremyfelt opened this issue Sep 1, 2022 · 4 comments · Fixed by #43797
Assignees
Labels
[Package] Babel plugin makepot /packages/babel-plugin-makepot

Comments

@jeremyfelt
Copy link
Member

jeremyfelt commented Sep 1, 2022

Description

After I updated a project's @wordpress/babel-plugin-makepot dependency to 5.0.0, its build started showing a TypeError with the message "translations is not iterable".

I looked at the commit history for the package and while the release notes show an upgrade to Node 14 as a breaking change, a commit was included that replaces the use of Lodash's sortBy().

I am not an expert by any means, but from what I can tell, Lodash's sortBy() expected either an array or an object to be passed. The new sortByReference() added to babel-plugin-makepot as a replacement expects and handles only arrays even though the translations passed to it by babel-plugin-makepot are always objects.

I can't find an example of how Gutenberg or WordPress are using this package, so I'm not completely confident that I'm not doing something wrong, but I've reproduced the issue in a simple package and have found at least one example on GitHub of another project using this package with the same error.

Step-by-step reproduction instructions

  1. Check out https://github.com/jeremyfelt/babel-bug/tree/wp-babel-5.0.0
  2. npm install
  3. npm run build
  4. See error

If you check out the wp-babel-4.0.0 branch on that project, there is no error.

Screenshots, screen recording, code snippet

No response

Environment info

  • Node 16.5.1

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@jeremyfelt jeremyfelt added the [Package] Babel plugin makepot /packages/babel-plugin-makepot label Sep 1, 2022
@Mamaduka
Copy link
Member

Mamaduka commented Sep 2, 2022

Cc @tyxla

@tyxla
Copy link
Member

tyxla commented Sep 2, 2022

Thanks for reporting @jeremyfelt 🙌 .

For some odd reason, this never came up in my testing or in the review of the related PR - #43479. I must have been testing it the wrong way.

Fix incoming shortly.

@tyxla tyxla self-assigned this Sep 2, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Sep 2, 2022
@tyxla
Copy link
Member

tyxla commented Sep 2, 2022

Fix in #43797.

This will obviously need a point release after merging.

@jeremyfelt
Copy link
Member Author

Works great, thanks for the quick fix @tyxla!

@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Babel plugin makepot /packages/babel-plugin-makepot
4 participants