vite-plugin-i18next-loader weekly downloads statistics
By alienfast · npm · Vite plugins
Vite plugin loader for client embedded i18next locales composited from one to many json or yaml files.
vite-plugin-i18next-loader has 43,555 recorded weekly downloads on npm, an increase of 1.3% over the past 30 days, ranking #822 of 3,247 tracked listings.
About vite-plugin-i18next-loader
vite-plugin-i18next-loader
pnpm add -D vite-plugin-i18next-loader
Vite plugin to client bundle i18next locales composited from one to many json/yaml files from one to many libraries. Zero config HMR support included.
This vite-plugin i18next loader generates the resources structure necessary for i18next. The structure is made available as a virtual module to the client bundle at build time, thus avoiding loading any language resources via extra HTTP requests.
Features
- Glob based file filtering
- One to many overrides supporting reuse cases (locales in library packages/white labeling)
- Yaml and Json support
- HMR hot module reloading
- Better chunking/tree shaking may already be possible, see https://github.com/alienfast/vite-plugin-i18next-loader/issues/4 - needs more trial/discussion.
Given a locales directory, by default, the loader will find and parse any json|yaml|yml file and attribute the
contents to the containing lang folder e.g. en. There is no need to add lang such as en or de inside your
json or yaml files.
See the test/data directory for structure and example data.
Usage
Sample app structure
└── app
└── src
│ └── index.js
└── locales
├── de
│ ├── foo.json
│ └── bar.yaml
└── en
├── foo.json
└── bar.yaml
vite.config.ts
import { defineConfig } from 'vite'
import i18nextLoader from 'vite-plugin-i18next-loader'
export default defineConfig({
plugins: [i18nextLoader({ paths: ['./node_modules/foo/locales', './locales'] })],
})
app.ts
// File: app.ts
import i18n from 'i18next'
import resources,{ langs, namespaces } from 'virtual:i18next-loader'
i18n.init({
supportedLngs: langs,
ns: namespaces,
resources,
})
// Use the resources as documented on i18next.com
i18n.t('key')
Options
export interface Options {
/**
* Set to 'info' for noisy information.
*
* Default: 'warn'
*/
logLevel?: LogLevel
/**
* Glob patterns to match files
*
* Default: ['**\/*.json', '**\/*.yml', '**\/*.yaml']
*/
include?: string[]
/**
* Glob patterns to exclude/ignore
*
* @see https://github.com/isaacs/node-glob
*/
ignore?: string | string[] | IgnoreLike
/**
* Locale top level directory paths ordered from least specialized to most specialized
* e.g. lib locale -> app locale
*
* Locales loaded later will overwrite any duplicated key via a deep merge strategy.
*/
paths: string[]
/**
* Default: none
*/
namespaceResolution?: 'basename' | 'relativePath'
}
include to filtering files read
You can filter files in your file structure by specifying any glob supported by glob. By default, any json|yaml|yml in the paths directories will be loaded.
Only json
const options = {
include: ['**/*.json'],
}
All json except one file
const options = {
include: ['**/*.json'],
ignore: ['**/excludeThis.json'],
}
paths for overriding/white labeling
Applications that reuse libraries e.g. white labeling, can utilize one to many sets of locale directories that the app will override.
const options = {
include: ['../node_modules/lib1/locales', './locales'], // from least to most specialized
}
This configures the loader to work on a file structure like the following:
└── app
├── src
│ └── app.js
├── locales
│ └── en
│ ├── foo.json
│ └── bar.yaml
└── node_modules
└── lib1
└── locales
└── en
├── foo.json
└── bar.yaml
Everything from ./locales will override anything specified in one to many libraries.
namespaceResolution
Namespace resolution will impact the structure of the bundle. If you want the files' basename or relative path to be injected, look at the following options.
namespaceResolution: 'basename'
const options = {
namespaceResolution: 'basename',
}
The following file structure would result in resources loaded as below:
└── app
├── src
│ └── index.js
└── locales
└── en
├── foo.json
└── bar.yaml
foo.json
{
"header": {
"title": "TITLE"
}
}
bar.yaml
footer:
aboutUs: About us
Results in this object loaded:
{
"en": {
"foo": {
"header": {
"title": "TITLE"
}
},
"bar": {
"footer": {
"aboutUs": "About us"
}
}
}
}
namespaceResolution: 'relativePath'
const options = {
namespaceResolution: 'relativePath',
}
The following file structure would result in resources loaded as below:
└── app
└── locales
├── index.js
└── en
├── green.yaml
└── blue
└── foo.yaml
green.yaml
tree:
species: Oak
blue/foo.yaml
water:
ocean: Quite large
Results in this object loaded:
{
"en": {
"green": {
"tree": {
"species": "Oak"
}
},
"blue": {
"foo": {
"water": {
"ocean": "Quite large"
}
}
}
}
}
```…
Description from the npm listing.
- vite-plugin
- loader
- i18next
- locales
- yaml
- json
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (591)Similar npm Vite plugins plugins
All 20 vite-plugin-i18next-loader alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/vite-plugin-i18next-loader. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.