Route-aware i18n bundler for Vite that extracts translation keys via AST analysis at build time and emits per-route scope-matched JSON bundles. Current stable version is 0.7.2, released with weekly or bi-weekly cadence. Unlike traditional i18n libraries (react-i18next, vue-i18n) that load all translations globally, vite-bundled-i18n tree-shakes translations per page, reducing payload from thousands of keys to only the ones needed for the current route. Supports React, Vue, and vanilla JS with a shared ~50-line core, optional compiled Map modules for O(1) lookup, SSR with automatic hydration, type-safe placeholder validation, and a testing utility. Requires Node >=20, peer deps: react >=18, react-dom >=18, vue ^3.0.0, eslint >=8.
npm install vite-bundled-i18nVerified import paths — ran on the pinned version, not inferred.
Shows minimal setup: configure Vite plugin, use useI18n hook in React component, create a JSON locale file.
Replace 'import { viteBundledI18n } from 'vite-bundled-i18n'' with 'import { i18nPlugin } from 'vite-bundled-i18n''.Use dynamic import() or switch project to ESM ("type": "module" in package.json).Use the plugin's built-in scope map handling; remove calls to createScopeMapClient.
Ensure translation files are in 'src/locales/' or configure with 'bundling.localesDir'.
Use 'import { t } from 'vite-bundled-i18n/react'' for React projects.Switch your project to ESM ("type": "module" in package.json) or use dynamic import: const { i18nPlugin } = await import('vite-bundled-i18n');Import as: import { i18nPlugin } from 'vite-bundled-i18n'Check the correct subpath: for React use '/react', for Vue '/vue', for vanilla '/vanilla'