Registry / web-framework / esbuild-plugin-i18next-loader

esbuild-plugin-i18next-loader

JSON →
library1.1.5jsnpmunverified

esbuild plugin to bundle i18next translation files (JSON/YAML) into a virtual module for client-side use. Current stable version is 1.1.5, released under the i18next-utilities monorepo with regular patch updates. It rewrites alienfast/vite-plugin-i18next-loader for esbuild, supporting namespace resolution via basename or relative path, and multiple locale paths. Differentiators: ESM-only builds, TypeScript types included, virtual module generation for tree-shaking.

npm install esbuild-plugin-i18next-loader
INSTALL
IMPORT
SIG · ESBUILD-PLUGIN-I18
E
esbuild-plugin-i18next-loader
web-frameworkjavascriptv1.1.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

i18nextPlugin
import { i18nextPlugin } from 'esbuild-plugin-i18next-loader'
const i18nextPlugin = require('esbuild-plugin-i18next-loader').i18nextPlugin
ESM-only, no CommonJS support. Use dynamic import if needed.
default
import i18nextPlugin from 'esbuild-plugin-i18next-loader'
import { default as i18nextPlugin } from 'esbuild-plugin-i18next-loader'
Default export is the plugin function, but named export is preferred.
type Options
import type { Options } from 'esbuild-plugin-i18next-loader'
import { Options } from 'esbuild-plugin-i18next-loader'
Options type is not a runtime value; use type import for TypeScript.

Shows how to use the plugin with esbuild to bundle i18next locale files from ./src/locales.

import { i18nextPlugin } from 'esbuild-plugin-i18next-loader'; import esbuild from 'esbuild'; await esbuild.build({ entryPoints: ['./src/index.ts'], write: true, bundle: true, plugins: [ i18nextPlugin({ namespaceResolution: 'basename', paths: ['./src/locales'], }), ], });
Debug
Known issues
breakingESM-only since v1.1.3
fix
Use import syntax instead of require(). If using CommonJS, consider dynamic import.
affects: >=1.1.3
gotchanamespaceResolution strategy must be set explicitly; if omitted, namespace defaults to basename but may cause collisions.
fix
Set namespaceResolution to 'basename' or 'relativePath' as needed.
affects: >=1.0.0
deprecatedPlugin name changed from default export to named export in v1.1.0
fix
Use named import { i18nextPlugin } instead of default import.
affects: >=1.1.0
Errors
Common errors & fixes
Cannot find module 'esbuild-plugin-i18next-loader'
Package not installed or incorrect import path.
fix
Run npm install --save-dev esbuild-plugin-i18next-loader and ensure import path is correct.
require() of ES Module esbuild-plugin-i18next-loader not supported
Package is ESM-only, require() not allowed.
fix
Use dynamic import: const { i18nextPlugin } = await import('esbuild-plugin-i18next-loader');
TypeError: i18nextPlugin is not a function
Using default import after v1.1.0 when named export is required.
fix
Use import { i18nextPlugin } from 'esbuild-plugin-i18next-loader';
Upgrade
Version history
1.1.5latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency required for plugin to function
i18nextrequiredpeer dependency for runtime locale usage
Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-plugin-i18next-loader — npm install esbuild-plugin-i18next-loader · libregistry