linguijs - Compile --strict "under the hood" with @linguivite-plugin - Stack Overflow

admin2025-04-16  5

one the one hand there is an option to compile messages strictly /ref/cli#compile-strict

on the other hand there´s a vite plugin that compiles those "under the hood"

Isn´t there a compile option for the vite plugin in order to make sure that no translations are missing? I cannot find any....

According to lingui.dev documentation it´s possible to make sure that no translations are missing by running the script "lingui compile --strict".

In combination with @lingui/vite-plugin this does not make much sense, since the vite-plugin takes care of the compilation "on the fly" [/ref/vite-plugin]

one the one hand there is an option to compile messages strictly https://lingui.dev/ref/cli#compile-strict

on the other hand there´s a vite plugin that compiles those "under the hood"

Isn´t there a compile option for the vite plugin in order to make sure that no translations are missing? I cannot find any....

According to lingui.dev documentation it´s possible to make sure that no translations are missing by running the script "lingui compile --strict".

In combination with @lingui/vite-plugin this does not make much sense, since the vite-plugin takes care of the compilation "on the fly" [https://lingui.dev/ref/vite-plugin]

Share Improve this question asked Feb 3 at 12:53 RaraRara 111 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

It's now possible with the recent 5.3.0 release.

This release introduces the failOnMissing option for both the Vite plugin and Webpack loader.

Once the failOnMissing option is enabled, the build will fail if there are missing translations. This is useful to ensure that production builds don't have missing translations.

For Vite & Webpack this option should be passed directly to theirs config. lingui compile will perform this check if the --strict flag is passed.

转载请注明原文地址:http://anycun.com/QandA/1744770815a87388.html