{"id":22566,"library":"vite-intlayer","title":"vite-intlayer","description":"A Vite plugin for seamless internationalization (i18n) in Vite projects. Current stable version is 8.7.7, but note that recent releases show a separate version track (2.0.13) for the intlayer ecosystem; the plugin integrates with @intlayer/core for locale detection, redirection, and environment-based configuration. It ships TypeScript types and requires Vite >=4.0.0. Key differentiators: tight integration with Intlayer's dictionary system, automatic locale-based redirects, and support for React and other frameworks via companion compilers.","status":"maintenance","version":"8.7.7","language":"javascript","source_language":"en","source_url":"https://github.com/aymericzip/intlayer","tags":["javascript","intlayer","data","internationalization","multilingual","i18n","typescript","react","vite"],"install":[{"cmd":"npm install vite-intlayer","lang":"bash","label":"npm"},{"cmd":"yarn add vite-intlayer","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-intlayer","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for JavaScript/TypeScript compilation of i18n content","package":"@babel/core","optional":false},{"reason":"Peer dependency; plugin only works with Vite >=4.0.0","package":"vite","optional":false}],"imports":[{"note":"This is a named export, not a default export.","wrong":"import viteIntlayer from 'vite-intlayer'","symbol":"viteIntlayer","correct":"import { viteIntlayer } from 'vite-intlayer'"},{"note":"Part of Vite's core, but often confused as an export from vite-intlayer.","wrong":null,"symbol":"defineConfig","correct":"import { defineConfig } from 'vite'"},{"note":"TypeScript only; use 'import type' for type imports.","symbol":"IntlayerPluginOptions","correct":"import type { IntlayerPluginOptions } from 'vite-intlayer'"},{"note":"vite-intlayer does not have a default export in CJS; use destructuring.","wrong":"const viteIntlayer = require('vite-intlayer')","symbol":"default (CommonJS)","correct":"const { viteIntlayer } = require('vite-intlayer')"}],"quickstart":{"code":"// vite.config.ts\nimport { defineConfig } from 'vite';\nimport react from '@vitejs/plugin-react';\nimport { viteIntlayer } from 'vite-intlayer';\n\nexport default defineConfig({\n  plugins: [\n    react(),\n    viteIntlayer({\n      // Configuration options (optional)\n      // locales: ['en', 'fr', 'es'],\n      // defaultLocale: 'en',\n    }),\n  ],\n});","lang":"typescript","description":"Shows how to add the vite-intlayer plugin to a Vite config file, with import and usage."},"warnings":[{"fix":"Replace 'vite-plugin-intlayer' with 'vite-intlayer' in package.json and imports.","message":"In version 2.x, the plugin was renamed from 'vite-plugin-intlayer' to 'vite-intlayer'. Update your imports.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Move redirect configuration under localeDetection: { redirect: ... }.","message":"The 'redirect' option in plugin configuration has been deprecated; use 'localeDetection.redirect' instead.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Set 'strict: true' in tsconfig.json.","message":"If using TypeScript, ensure 'strict' mode is enabled to avoid type errors with locale dictionaries.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add an alias in vite.config.ts: resolve: { alias: { '@intlayer/locales': path.resolve(__dirname, 'locales') } }.","message":"The plugin expects Vite's resolve.alias to be configured if you have custom locale directory paths; otherwise locales may not be found.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to version 16 or later.","message":"Support for Node.js <14.18 is deprecated; future versions may require Node >=16.","severity":"deprecated","affected_versions":">=6.0.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run 'npm install vite-intlayer' and ensure your import matches the package name.","cause":"The package is not installed or is installed under an old name.","error":"Error: Cannot find module 'vite-intlayer'"},{"fix":"Change import to: import { viteIntlayer } from 'vite-intlayer'","cause":"Default import was used instead of named import.","error":"TypeError: viteIntlayer is not a function"},{"fix":"Install @intlayer/config: npm install @intlayer/config","cause":"Missing peer dependency @intlayer/config.","error":"[vite] Internal server error: Failed to resolve import \"@intlayer/config\" from \"vite-intlayer\""},{"fix":"Move redirect option under localeDetection object as documented.","cause":"Using deprecated configuration key.","error":"ERROR: The 'redirect' option is not allowed. Use 'localeDetection.redirect' instead."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}