Skip to content

Commit 5b2ef0b

Browse files
authored
docs: add unplugin-vue-i18n setting for petite-vue-i18n (#1968)
1 parent d8d6180 commit 5b2ef0b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/guide/advanced/lite.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,38 @@ registerLocaleFallbacker(fallbackWithLocaleChain)
207207

208208
With the above settings, locale message resolving and locale fallbacking will be handled in the same way as in vue-i18n, note that the code size will increase slightly.
209209

210+
### Setting bundler plugin
211+
212+
If you are building your application with a build toolchain like vite, you must configure it.
213+
Please set the [‘module’ option in `@intlify/unplugin-vue-i18n`](https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n#module) configuration as follows.
214+
215+
> [!NOTE]
216+
> About `@intlify/unplugin-vue-i18n` setting, see the ['performance' section](./optimization.md) and [`@intlify/unplugin-vue-i18n` docs](https://github.com/intlify/bundle-tools/blob/main/packages/unplugin-vue-i18n/README.md)
217+
218+
> [!IMPORTANT]
219+
> `@intlify/unplugin-vue-i18n` version must **5.1.0 and later**
220+
221+
```diff
222+
// vite.config.ts
223+
import { defineConfig } from 'vite'
224+
import { resolve, dirname } from 'node:path'
225+
import { fileURLToPath } from 'url'
226+
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'
227+
228+
export default defineConfig({
229+
/* ... */
230+
plugins: [
231+
/* ... */
232+
VueI18nPlugin({
233+
/* options */
234+
+ module: 'petite-vue-i18n',
235+
// locale messages resource pre-compile option
236+
include: resolve(dirname(fileURLToPath(import.meta.url)), './path/to/src/locales/**'),
237+
}),
238+
],
239+
})
240+
```
241+
210242
### Switch without changing import id
211243

212244
You can switch from vue-i18n to petite-vue-i18n in your application using npm alias without changing the import id.

0 commit comments

Comments
 (0)