rollup-plugin-typed-dotenv
v1.1.3
Published
When this plug-in replaces code with environment variables, it converts to an appropriate form according to the plugin settings.
Downloads
12
Maintainers
Readme
rollup-plugin-typed-dotenv
About
Rollup plugin of dotenv
Detail
When this plug-in replaces code with environment variables, it converts to an appropriate form (for String, enclose it in double quotes, etc.) according to the plugin settings.
Sample of the source code
BEFORE
// main.js
console.log(process.env.ROLLUP_VALUE_STRING);
console.log(process.env.ROLLUP_VALUE_NUMBER);
console.log(process.env.ROLLUP_VALUE_FALSE);
#.env
ROLLUP_VALUE_STRING=Test value
ROLLUP_VALUE_NUMBER=2
ROLLUP_VALUE_FALSE=FALSE
AFTER
// main.js
console.log('Test value');
console.log(2);
console.log(false);
Installation
NPM
npm install -D rollup-plugin-typed-dotenv
Yarn
yarn add -D rollup-plugin-typed-dotenv
Usage
Options
envDir
Type:string
Default: process.cwd()
directory in which to search for env files.
envPrefix
Type:string
Default: ROLLUP_
Only enviroment valiable which has this prefix is exposed to javascript code.
envKey
Type:string
Default: NODE_ENV
Key used to search for .env files for environment in which an application is running
preventAssignment
See document of rollup-plugin-replace
values
define type of environment valiables
{
ROLLUP_VALUE_STRING: 'string',
ROLLUP_VALUE_NUMBER: 'number',
ROLLUP_VALUE_FALSE: 'boolean',
}
Supported types
- string
- number
- boolean