Registry / rollup-plugin-i18never

rollup-plugin-i18never

JSON →
library1.1.16jsnpmunverified

A Rollup plugin for automatic internationalization (i18n) using i18never. Version 1.1.16 ships TypeScript types and requires Rollup ^3.26.3 as a peer dependency. It provides zero-config extraction of translatable strings from source code, enabling build-time injection of locale dictionaries. Unlike runtime i18n libraries, this plugin statically replaces i18n function calls with translated strings at build time, eliminating runtime overhead. Designed for small to medium projects that want simple i18n without heavy frameworks. Released in 2023 with occasional maintenance updates.

npm install rollup-plugin-i18never
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-I18N
R
rollup-plugin-i18never
javascriptv1.1.16
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.

default (i18never)
import i18never from 'rollup-plugin-i18never'
const i18never = require('rollup-plugin-i18never')
The package outputs an ESM default export; CJS require works in Rollup config due to Rollup's handling, but for consistency use ESM import.
default (in Vite config)
import i18never from 'rollup-plugin-i18never' // vite.config.js export default defineConfig({ plugins: [i18never()] })
plugins: [i18never] // forgot parentheses to call the function
The plugin must be called as a function (i18never()) to return a plugin object.
default (in CommonJS)
const i18never = require('rollup-plugin-i18never');
const { i18never } = require('rollup-plugin-i18never')
The package has only a default export; destructuring will result in undefined.

Minimal Rollup configuration using the i18never plugin to statically replace i18n function calls with translations at build time.

// Install: npm install rollup rollup-plugin-i18never // rollup.config.js import i18never from 'rollup-plugin-i18never'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'es' }, plugins: [ i18never({ // options (optional): translations, functions, locales, etc. }) ] }; // src/index.js // Requires i18never runtime to be set up separately import { t } from 'i18never'; console.log(t('hello')); // Build command: npx rollup --config rollup.config.js
Debug
Known issues
gotchaPlugin must be called as a function: i18never() not i18never
fix
Use plugins: [i18never()] instead of plugins: [i18never]
affects: all
gotchaThe plugin only works with i18never runtime installed and configured separately; it does not provide i18n runtime. Missing i18never will cause runtime errors.
fix
Install i18never package: npm install i18never, and initialize it before using t() calls.
affects: all
gotchaThe plugin statically replaces strings at build time; dynamic keys (e.g., t(variable)) will not be translated and may cause unexpected behavior.
fix
Ensure all translatable strings are literal strings passed to t() or other configured translation functions.
affects: all
deprecatedRequires Rollup ^3.26.3; not officially tested with Rollup 4.x. May work but no guarantees.
fix
Consider pinning Rollup to version 3.x, or check plugin compatibility with Rollup 4.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Plugin 'i18never' does not exist? (no error string provided in docs, but common missing call issue) Actually, typical error: 'TypeError: i18never is not a function'
Importing the default export but treating it as a plugin object, not calling it as a function.
fix
Use plugins: [i18never({})] instead of plugins: [i18never]
Error: Cannot find module 'i18never' (or equivalent when runtime not installed).
The i18never runtime package is required in the bundled output; the plugin does not bundle it.
fix
Install i18never: npm install i18never, and ensure it is imported in your source files.
ReferenceError: t is not defined (at runtime)
Missing i18never runtime initialization.
fix
Import and initialize i18never before using t(): import i18never from 'i18never'; i18never.init({locale: 'en', translations: ...});
Upgrade
Version history
1.1.16latest on npm
Audit
Dependencies
rolluprequiredpeer dependency: works as a Rollup plugin, must be installed alongside
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-i18never — npm install rollup-plugin-i18never · libregistry