@lingui/vite-plugin
TypeScript icon, indicating that this package has built-in type declarations

4.11.0 • Public • Published

License Version Downloads

@lingui/vite-plugin

Vite plugin that compiles Lingui catalogs on the fly. In summary, the lingui compile command isn't needed when using this plugin.

@lingui/vite-plugin is part of LinguiJS. See the documentation for all information, tutorials and examples.

Installation

npm install --save-dev @lingui/vite-plugin
# yarn add --dev @lingui/vite-plugin

Usage

Via vite.config.ts

import { UserConfig } from 'vite';
import { lingui } from '@lingui/vite-plugin'

const config: UserConfig = {
  plugins: [lingui()]
}

Then in Vite-processed code:

// *.po files assigned to this loader by default
const { messages } = await import(`./locales/${language}.po`);

// for other extension you have to use `?lingui` suffix
const { messages } = await import(`./locales/${language}.json?lingui`);

See Vite's official documentation for more info about Vite dynamic imports https://vitejs.dev/guide/features.html#dynamic-import

License

MIT

/@lingui/vite-plugin/

    Package Sidebar

    Install

    npm i @lingui/vite-plugin

    Weekly Downloads

    13,209

    Version

    4.11.0

    License

    MIT

    Unpacked Size

    12.8 kB

    Total Files

    9

    Last publish

    Collaborators

    • andrii.bodnar
    • serhiydmytryshyn