1.0.3 • Published 6 years ago
ts-transform-node-env-inline v1.0.3
ts-transform-node-env-inline
- :flashlight: Inline environment variables, e.g.
process.env.NODE_ENV
Inline environment variables.
Example
In
process.env.NODE_ENV === "development";
process.env.NODE_ENV === "production";
// tsconfig.json
{
"compilerOptions": {
"target": "es2015",
"plugins": [
{
"transform": "../lib",
"type": "config",
"env": { "NODE_ENV": "hello-world" }
}
]
}
}
Out
process.env.NODE_ENV === "development";
process.env.NODE_ENV === "production";
Installation
npm install ts-transform-node-env-inline ttypescript --save-dev
Usage
// tsconfig.json
{
"compilerOptions": {
"target": "es2015",
"plugins": [
{
"transform": "../lib",
"type": "config",
"env": { "NODE_ENV": "production" }
}
]
}
}
See TTypeScript for docs about integration with other toolchains.
See ./example for a basic setup based on TTypeScript
Prior art
License
MIT