Skip to main content

4 posts tagged with "features"

View All Tags

Lingui Without a Build Step: the Runtime Macro

· 2 min read
Andrii Bodnar
Engineering Manager

Lingui macros turn msg`Hello` into a message descriptor at build time, so they need Babel, SWC or the native transform. That works well in apps, but not everywhere. Node.js scripts, serverless functions, CLI tools and test runners often run your code as it is, with no compile step. The new experimental runtime macro covers those cases.

Native Macro Transform for Vite

· 3 min read
Andrii Bodnar
Engineering Manager

Lingui macros have always needed a compiler plugin: Babel or SWC turns t`Hello` and <Trans> into runtime calls at build time. In Vite that meant wiring the macro plugin into whichever compiler your framework plugin uses. The new native macro transform removes that step. One option in vite.config.ts, and @lingui/vite-plugin transforms macros itself.

social-card image

Introducing Context Directives

· 3 min read
Andrii Bodnar
Engineering Manager

One of Lingui's biggest ergonomic wins is keyless translations - you write the source string directly in your code and Lingui generates a stable ID for you. But that convenience quietly breaks down the moment you need context to prevent collisions across files. Suddenly you're writing context: "checkout" on every macro call in every file, which defeats the whole point.

social-card image