Vite plugin that bundles i18next locale resources (JSON/YAML) as a virtual module during build, avoiding HTTP requests for locale files. Current stable version is 3.1.3, requires Node >=20, and peer dependency Vite >=3.1.6. It composes resources from one or many glob-matched directories, supports HMR, and allows overriding via ordered paths for white-labeling. Unlike alternatives that rely on runtime fetching or separate bundling, this plugin generates the entire `resources` structure at build time, enabling zero-config i18n loading.
npm install vite-plugin-i18next-loaderVerified import paths — ran on the pinned version, not inferred.
Configures the Vite plugin with multiple locale paths and imports the generated virtual module for i18n initialization.
Update your `ignore` patterns to follow glob syntax (e.g., '**/exclude.json' instead of 'exclude.json'). If you were using glob-all's array format, wrap patterns in an array.
Upgrade Node.js to version 20 or later, or stay on v3.1.2 which supported older Node versions (though with out-of-date dependencies).
Double-check that `i18nextLoader()` is added to the `plugins` array in your Vite config. If you have multiple configs, ensure it's present in all builds.
Convert your project to ESM (use 'type': 'module' in package.json) or use dynamic import: `const i18nextLoader = (await import('vite-plugin-i18next-loader')).default`.Ensure locale files are within the Vite project directory and validate your YAML/JSON files for errors. If HMR still fails, check the Vite dev server logs for 'vite-plugin-i18next-loader' warnings.
Run `npm install -D vite-plugin-i18next-loader` or `yarn add -D vite-plugin-i18next-loader`.
Use `import` instead of `require()`. If you must use CommonJS, use dynamic import: `const i18nextLoader = (await import('vite-plugin-i18next-loader')).default`.Make sure to add `i18nextLoader({...})` to the `plugins` array in your `vite.config.ts`.Verify that the locale files exist in the specified directories and match the default or custom `include` patterns.