Registry / web-framework / vite-intlayer

vite-intlayer

JSON →
library8.7.7jsnpmunverified

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.

npm install vite-intlayer
INSTALL
IMPORT
SIG · VITE-INTLAYER
V
vite-intlayer
web-frameworkjavascriptv8.7.7
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

viteIntlayer
import { viteIntlayer } from 'vite-intlayer'
import viteIntlayer from 'vite-intlayer'
This is a named export, not a default export.
defineConfig
import { defineConfig } from 'vite'
Part of Vite's core, but often confused as an export from vite-intlayer.
IntlayerPluginOptions
import type { IntlayerPluginOptions } from 'vite-intlayer'
TypeScript only; use 'import type' for type imports.
default (CommonJS)
const { viteIntlayer } = require('vite-intlayer')
const viteIntlayer = require('vite-intlayer')
vite-intlayer does not have a default export in CJS; use destructuring.

Shows how to add the vite-intlayer plugin to a Vite config file, with import and usage.

// vite.config.ts import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { viteIntlayer } from 'vite-intlayer'; export default defineConfig({ plugins: [ react(), viteIntlayer({ // Configuration options (optional) // locales: ['en', 'fr', 'es'], // defaultLocale: 'en', }), ], });
Debug
Known issues
breakingIn version 2.x, the plugin was renamed from 'vite-plugin-intlayer' to 'vite-intlayer'. Update your imports.
fix
Replace 'vite-plugin-intlayer' with 'vite-intlayer' in package.json and imports.
affects: >=2.0.0
deprecatedThe 'redirect' option in plugin configuration has been deprecated; use 'localeDetection.redirect' instead.
fix
Move redirect configuration under localeDetection: { redirect: ... }.
affects: >=5.0.0
gotchaIf using TypeScript, ensure 'strict' mode is enabled to avoid type errors with locale dictionaries.
fix
Set 'strict: true' in tsconfig.json.
affects: >=1.0.0
gotchaThe plugin expects Vite's resolve.alias to be configured if you have custom locale directory paths; otherwise locales may not be found.
fix
Add an alias in vite.config.ts: resolve: { alias: { '@intlayer/locales': path.resolve(__dirname, 'locales') } }.
affects: >=1.0.0
deprecatedSupport for Node.js <14.18 is deprecated; future versions may require Node >=16.
fix
Upgrade Node.js to version 16 or later.
affects: >=6.0.0
Errors
Common errors & fixes
Error: Cannot find module 'vite-intlayer'
The package is not installed or is installed under an old name.
fix
Run 'npm install vite-intlayer' and ensure your import matches the package name.
TypeError: viteIntlayer is not a function
Default import was used instead of named import.
fix
Change import to: import { viteIntlayer } from 'vite-intlayer'
[vite] Internal server error: Failed to resolve import "@intlayer/config" from "vite-intlayer"
Missing peer dependency @intlayer/config.
fix
Install @intlayer/config: npm install @intlayer/config
ERROR: The 'redirect' option is not allowed. Use 'localeDetection.redirect' instead.
Using deprecated configuration key.
fix
Move redirect option under localeDetection object as documented.
Upgrade
Version history
8.7.7latest on npm
Audit
Dependencies
@babel/corerequiredRequired for JavaScript/TypeScript compilation of i18n content
viterequiredPeer dependency; plugin only works with Vite >=4.0.0
Agent activity
12 hits · last 30 days
node
10
OpenAI (training)
1
Resources
vite-intlayer — npm install vite-intlayer · libregistry