Skip to content

a1ooha/unplugin-lingui-loader

Repository files navigation

unplugin-lingui-loader

NPM version

It’s a good practice to use compiled message catalogs during development. However, running compile everytime messages are changed soon becomes tedious.

unplugin-lingui-loader is plugin for Vite, Rollup, Webpack, and more, which compiles messages on the fly!

Live Demo

Install

npm i -D unplugin-lingui-loader
Vite
// vite.config.ts
import LinguiLoader from 'unplugin-lingui-loader/vite'

export default defineConfig({
  plugins: [
    LinguiLoader(),
  ],
})

Example: playground/


Rollup
// rollup.config.js
import LinguiLoader from 'unplugin-lingui-loader/rollup'

export default {
  plugins: [
    LinguiLoader(),
  ],
}


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-lingui-loader/webpack')()
  ]
}


Nuxt
// nuxt.config.js
export default {
  buildModules: [
    ['unplugin-lingui-loader/nuxt'],
  ],
}

This module works for both Nuxt 2 and Nuxt Vite


Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-lingui-loader/webpack')(),
    ],
  },
}


esbuild
// esbuild.config.js
import { build } from 'esbuild'
import LinguiLoader from 'unplugin-lingui-loader/esbuild'

build({
  plugins: [LinguiLoader()],
})