opral / inlang-paraglide-js

Tree-shakable i18n library build on the inlang ecosystem.
https://inlang.com/m/gerre34r/library-inlang-paraglideJs
23 stars 0 forks source link

NextJS: Call the Paraglide Compiler Programmatically #96

Closed LorisSigrist closed 1 month ago

LorisSigrist commented 2 months ago

Context

The way the paraglide compiler get's called in NextJS projects is a bit of a hack. Internally it just calls the Paraglide CLI using exec_sync. This occasionally causes issues if the package manager can't locate the paraglide-js command.

It's currently done this way because the plugin needs to run from a CJS environment & doesn't have the opportunity to await anywhere.

Proposal

Remove the dependency on the CLI by instead spinning up a separate, ESM node process from the paragliden-next package via exec_sync. This would avoid any command-resolution issues