Registry / devops / rollup-plugin-variables

rollup-plugin-variables

JSON →
library0.1.1jsnpmunverified

A Rollup plugin that replaces custom markers (e.g., [[VARIABLE]]) in source files with values from a separate variables file (JS, JSON, or TXT). Stable version 0.1.1. Low activity; last release in 2019. Key differentiator: allows externalizing environment-specific values without a full-fledged env replacement plugin. Limited to rollup.

npm install rollup-plugin-variables
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-VARI
R
rollup-plugin-variables
devopsjavascriptv0.1.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

default
✓ import variables from 'rollup-plugin-variables'
✗ const variables = require('rollup-plugin-variables')
ESM default import is only supported; CommonJS require may work if using a bundler
variables
✓ import variables from 'rollup-plugin-variables'
✗ import { variables } from 'rollup-plugin-variables'
Named export does not exist; use default import
None (type import)
✓ import type { RollupOptions } from 'rollup'; import variables from 'rollup-plugin-variables';
No dedicated type exports; types inferred from Rollup

Configures Rollup to replace [[variables]] with values from env.js during build.

// rollup.config.js import variables from 'rollup-plugin-variables'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'iife' }, plugins: [ variables({ fileName: 'env.js', format: 'js', marker: '[[]]' }) ] };
Debug
Known issues
gotchaDefault marker is [[]]; double brackets required.
fix
Ensure source files use [[VARIABLE_NAME]] syntax, or configure marker option.
affects: >=0.1.0
gotchaVariables file must export an object (module.exports = ...) when format is 'js'.
fix
Use module.exports = { KEY: 'value' } in .js file; for .json use JSON object directly.
affects: >=0.1.0
deprecatedPlugin is in maintenance mode; no updates expected.
fix
Consider migrating to @rollup/plugin-replace or similar.
affects: >=0.1.0
gotchaNested markers (e.g., [[[VAR]]]) not supported; will cause undefined replacement.
fix
Use flat variable names without nested brackets.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module './env.js'
Variables file path is resolved relative to rollup.config.js; file missing or incorrect.
fix
Ensure env.js exists in the same directory as rollup.config.js or provide absolute path via fileName option.
TypeError: variables is not a function
Using named import { variables } instead of default import.
fix
Use default import: import variables from 'rollup-plugin-variables'.
The marker format 'invalid' is not supported.
Marker option string or function must return a valid format like '[[]]' or '{{}}'.
fix
Use supported marker format: '[[]]', '{{}}', or another string with matching brackets.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
rolluprequiredPeer dependency - plugin requires Rollup to function
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-variables — npm install rollup-plugin-variables · libregistry