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

fix(experimental-extractor): fix various bugs #1958

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

thekip
Copy link
Collaborator

@thekip thekip commented Jun 16, 2024

  • update esbuild to 0.21.5
  • apply lingui macro on each file as esbuild plugin
  • remove buildExternalizeFilter in favour of {packages: external}
  • add test to check tree-shking works properly

Description

Implementing ideas from this comment: #1797 (comment)

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Examples update

Fixes # (issue)

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

Copy link

vercel bot commented Jun 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
js-lingui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2024 7:32am

Copy link

github-actions bot commented Jun 16, 2024

size-limit report 📦

Path Size
./packages/core/dist/index.mjs 2.86 KB (0%)
./packages/detect-locale/dist/index.mjs 723 B (0%)
./packages/react/dist/index.mjs 1.65 KB (0%)
./packages/remote-loader/dist/index.mjs 7.26 KB (0%)

- update esbuild to 0.21.5
- apply lingui macro on each file as esbuild plugin
- remove buildExternalizeFilter in favour of `{packages: external}`
Copy link
Contributor

@andrii-bodnar andrii-bodnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@andrii-bodnar andrii-bodnar merged commit 8b35acf into next Jun 18, 2024
14 checks passed
@andrii-bodnar andrii-bodnar deleted the feature/experimental-extractor branch June 18, 2024 08:52
@AndrewIngram
Copy link

Very similar to what I ended up doing! Will try this out once it's released. Alongside the rewrite to not use babel-plugin-macros, I think things will be in a much better place.

JSteunou pushed a commit to JSteunou/js-lingui that referenced this pull request Jun 26, 2024
- update esbuild to 0.21.5
- apply lingui macro on each file as esbuild plugin
- remove buildExternalizeFilter in favour of `{packages: external}`
@yunsii
Copy link
Contributor

yunsii commented Jun 29, 2024

Well, any plan to release a latest next version?

@andrii-bodnar
Copy link
Contributor

@yunsii I was planning to prepare the 5.0.0-next.0 version release on the next week

@andrii-bodnar
Copy link
Contributor

Hi @yunsii, the v5.0.0-next.0 is here 🙂

@yunsii
Copy link
Contributor

yunsii commented Jul 5, 2024

I will test it on next week 👌

@yunsii
Copy link
Contributor

yunsii commented Jul 8, 2024

Hi @yunsii, the v5.0.0-next.0 is here 🙂

Unfortunately it broken with type syntax like: export const getStaticProps: GetStaticProps = async ctx => {

image

Reproduction: https://github.com/yunsii/lingui-examples-nextjs-swc-1797/tree/lingui-next

It works after I remove all type syntax 😂

@thekip
Copy link
Collaborator Author

thekip commented Jul 8, 2024

Thanks for reporting, I use TS files in e2e test fixtures but none of them really has anything TS related 🤦‍♂️
Indeed it fails with this error, i was able to reproduce it in tests suite. I will prepare a fix.

@yunsii
Copy link
Contributor

yunsii commented Jul 8, 2024

Great, it works after I patched package.

It seems thant we can migrate from @lingui/macro to @lingui/core/macro and @lingui/react/macro progressively? One more question: does @lingui/swc-plugin compatiable with 5.0.0-next.0? 👀

@thekip
Copy link
Collaborator Author

thekip commented Jul 8, 2024

You can use an automatic codemod I prepared to migrate imports, https://github.com/lingui/codemods?tab=readme-ov-file#split-macro-imports

And yes, @lingui/swc-plugin is compatible.

@yunsii
Copy link
Contributor

yunsii commented Jul 9, 2024

@lingui/swc-plugin@4.0.4 is not compatible
image

Next.js@13.4.12 with babel plugin is okey, commit: yunsii/lingui-examples-nextjs-swc-1797@d6b0a19

@yunsii
Copy link
Contributor

yunsii commented Jul 9, 2024

Trans from @lingui/react/macro works with React.Key will print a warning message: Missing message ID, skipping.
image

But it still extracted.

Reproduction: yunsii/lingui-examples-nextjs-swc-1797@8d3a70d

@thekip
Copy link
Collaborator Author

thekip commented Jul 9, 2024

@lingui/swc-plugin@4.0.4 is not compatible image

Next.js@13.4.12 with babel plugin is okey, commit: yunsii/lingui-examples-nextjs-swc-1797@d6b0a19

My mistake, if you asking about split macro import feature, it's already ported to SWC plugin, but not released yet. So, yes, in terms of new imports, version 4 of swc plugin is incompatible.

@thekip
Copy link
Collaborator Author

thekip commented Jul 9, 2024

Trans from @lingui/react/macro works with React.Key will print a warning message: Missing message ID, skipping. image

But it still extracted.

Reproduction: yunsii/lingui-examples-nextjs-swc-1797@8d3a70d

Good catch, please create a separate issue, i will take a look.

@yunsii
Copy link
Contributor

yunsii commented Jul 9, 2024

Trans from @lingui/react/macro works with React.Key will print a warning message: Missing message ID, skipping. image
But it still extracted.
Reproduction: yunsii/lingui-examples-nextjs-swc-1797@8d3a70d

Good catch, please create a separate issue, i will take a look.

New issue: #1974

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

Successfully merging this pull request may close these issues.

None yet

4 participants