- 🔦 Inline environment variables, e.g.
process.env.NODE_ENV
Inline environment variables.
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";
npm install ts-transform-node-env-inline ttypescript --save-dev
// 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
MIT