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

Fix Paraglide-Compiler running twice on NextJS Dev Server Start #74

Closed LorisSigrist closed 2 months ago

LorisSigrist commented 2 months ago

Context

There is currently an issue where the paraglide compiler runs twice when the dev-server is started. Once to compile the initial state & once in watch mode. This slows down startup & looks janky.

The reason it runs twice is that the NextJS config is still using CJS (although they are slowly switching to ESM) and is entirely synchronous. We thus can't use the Inlang SDK directly from the plugin. Instead we call the Paraglide CLI via the command line. To ensure the files are around during build we run the compiler once, then during dev we start it in watch mode, which runs it a second time.

There are a few potential ways to fix this:

Proposal

For now, just silence it.