.TH "LOOSE\-ENVIFY" "1" "November 2022" "v1.3.0" "loose-envify man page" .SH "NAME" \fBloose-envify\fR \- replace Node\.js environment variables with plain strings .SH SYNOPSIS .P loose\-envify .SH DESCRIPTION .P Performs a Javascript source\-to\-source transformation (transpiling), that efficiently replaces Node\.js process\.env environment variables with plain strings\. This makes the environment variable checks faster and easier to optimize out\. .SH EXAMPLES .P Running this source code: .RS 2 .nf if (process\.env\.NODE_ENV === "development") { console\.log('development only') } .fi .RE .P through loose\-envify: .RS 2 .nf loose\-envify index\.js > bundle\.js .fi .RE .P with NODE_ENV set to production results in: .RS 2 .nf if ("production" === "development") { console\.log('development only') } .fi .RE .P which, when run through a minifier, would be stripped out completely\. .P However, if you run the same script through loose\-envify with NODE_ENV set to development it gives: .RS 2 .nf if ("development" === "development") { console\.log('development only') } .fi .RE .P The if statement will evaluate to true, so the code won't be removed\. .SH AUTHOR .P Andres Suarez \fB\fP .SH COPYRIGHT .P This manual page was written by Paolo Greppi \fB\fP for the Debian project (and may be used by others), also based on material from the envify README (https://github.com/hughsk/envify) by Hugh Kennedy \fB\fP and the envify contributors\.