Registry / devops / rollup-plugin-drupal-interface-translations

rollup-plugin-drupal-interface-translations

JSON →
library1.1.9jsnpmunverified

A Rollup and Vite plugin that extracts Drupal interface translation strings from JavaScript files into .pot (Portable Object Template) files. Currently v1.1.9, stable, with periodic releases. Key differentiator: it integrates Drupal's translation API into modern JavaScript build pipelines, supporting both Rollup and Vite. Unlike manual extraction, it automates generation of translation templates from Drupal's t() and Drupal.t() calls. Based on DrupalTranslationsWebpackPlugin but adapted for Rollup ecosystem.

npm install rollup-plugin-drupal-interface-translations
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-DRUP
R
rollup-plugin-drupal-interface-translations
devopsjavascriptv1.1.9
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.

default
import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations'
const drupalInterfaceTranslations = require('rollup-plugin-drupal-interface-translations')
This package is ESM-only. Using require() will throw an error. Must use import syntax.
drupalInterfaceTranslations
import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations'
import { drupalInterfaceTranslations } from 'rollup-plugin-drupal-interface-translations'
Export is a default export, not named. Named import will result in undefined.
Plugin
import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations'
import { Plugin } from 'rollup-plugin-drupal-interface-translations'
TypeScript type for the plugin is exported as Plugin but users typically import default function. Only needed for type annotations.

Minimal Rollup configuration to extract Drupal interface translations from main.js, generating a .pot file in translations/ folder.

import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations'; // https://rollupjs.org/configuration-options/ export default { input: 'main.js', plugins: [drupalInterfaceTranslations()], };
Debug
Known issues
breakingPackage is ESM-only. Using CommonJS require() will throw an error.
fix
Use import or configure Node.js to use ESM (e.g., "type": "module" in package.json).
affects: >=1.0.0
gotchaMust be added to Vite's rollupOptions.plugins, not root plugins array, or it won't execute correctly.
fix
When using Vite, define plugin inside build.rollupOptions.plugins, not in the top-level plugins array.
affects: >=1.0.0
deprecatedNo known deprecated features in current version.
Errors
Common errors & fixes
TypeError: drupalInterfaceTranslations is not a function
Using require() on ESM-only package.
fix
Change to import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations'
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Same as above, require() on ESM package.
fix
Use import syntax or upgrade Node to newer version with --experimental-require-module.
The plugin is not compatible with Vite if placed in root plugins array
Plugin works as Rollup plugin and must be placed under build.rollupOptions.plugins in Vite config.
fix
Move plugin to build.rollupOptions.plugins array.
Upgrade
Version history
1.1.9latest on npm
Audit
Dependencies
@rollup/pluginutilsrequiredUsed internally for createFilter to include/exclude files based on filterOptions.
Agent activity
7 hits · last 30 days
node
6
Resources
rollup-plugin-drupal-interface-translations — npm install rollup-plugin-drupal-interface-translations · libregistry