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-variablesVerified import paths — ran on the pinned version, not inferred.
Configures Rollup to replace [[variables]] with values from env.js during build.
Ensure source files use [[VARIABLE_NAME]] syntax, or configure marker option.
Use module.exports = { KEY: 'value' } in .js file; for .json use JSON object directly.Consider migrating to @rollup/plugin-replace or similar.
Use flat variable names without nested brackets.
Ensure env.js exists in the same directory as rollup.config.js or provide absolute path via fileName option.
Use default import: import variables from 'rollup-plugin-variables'.
Use supported marker format: '[[]]', '{{}}', or another string with matching brackets.