tangl-i18next-vite
raw JSON → 1.2.4 verified Mon Apr 27 auth: no javascript
Vite plugin for seamless i18next internationalization integration, v1.2.4. Provides fast, optimized bundling with automatic locale splitting and TypeScript support. Actively maintained. Differentiator: lightweight, zero-config setup compared to heavier alternatives like react-i18next.
Common errors
error Cannot find module 'tangl-i18next-vite' or its corresponding type declarations. ↓
cause The package is not installed or TypeScript cannot resolve types for CJS.
fix
Install the package: npm install tangl-i18next-vite --save-dev; for type resolution issues, set 'moduleResolution': 'bundler' in tsconfig.
error SyntaxError: Unexpected token 'export' ↓
cause tangl-i18next-vite is ESM-only and cannot be require'd directly.
fix
Use dynamic import() or convert your project to ESM (set 'type': 'module' in package.json).
error The requested module 'tangl-i18next-vite' does not provide an export named 'default' ↓
cause Incorrect import syntax; the plugin expects a named import.
fix
Use import { tanglI18nextVite } from 'tangl-i18next-vite' instead of default import.
error Plugin 'vite-plugin-i18n' (tangl-i18next-vite) threw an error: locales option must be an array ↓
cause Passing locales as a comma-separated string (old API) instead of array.
fix
Change to locales: ['en', 'es'] per v1.2.0+ breaking change.
Warnings
breaking Plugin options structure changed in v1.2.0: 'locales' is now an array, not comma-separated string. ↓
fix Update your Vite config to pass locales as an array e.g., locales: ['en', 'es'].
deprecated The 'namespaces' option is deprecated in v1.1.0. Use 'locales' with nested folder structure instead. ↓
fix Remove 'namespaces' and reorganize locale files into subdirectories per namespace.
gotcha Source locale files must have a .json extension; otherwise, the plugin ignores them silently. ↓
fix Ensure all locale files are .json and located under sourceDir.
gotcha When using TypeScript, the plugin type definitions are only bundled for ESM; CJS projects may need @ts-ignore or explicit type declarations. ↓
fix Set 'moduleResolution' to 'bundler' or 'node16' in tsconfig.json.
Install
npm install tangl-i18next-vite yarn add tangl-i18next-vite pnpm add tangl-i18next-vite Imports
- default wrong
const tanglI18nextVite = require('tangl-i18next-vite')correctimport tanglI18nextVite from 'tangl-i18next-vite' - vitePlugin wrong
import { tanglI18nextVite } from 'tangl-i18next-vite'correctimport { tanglI18nextVite } from 'tangl-i18next-vite' - type wrong
import { PluginOptions } from 'tangl-i18next-vite'correctimport type { PluginOptions } from 'tangl-i18next-vite'
Quickstart
import { defineConfig } from 'vite';
import tanglI18nextVite from 'tangl-i18next-vite';
export default defineConfig({
plugins: [
tanglI18nextVite({
locales: ['en', 'es'],
defaultLocale: 'en',
sourceDir: 'src/locales',
outDir: 'dist/locales',
}),
],
});