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:
Silence the first compiler run, making it invisible
Drop CJS support & require the ESM config (will be more palatable in a few months)
Spawn an ESM worker from the CJS config, run the inlang SDK in there & communicate back after the initial compilation.We would need to figure out how to await though.
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.