Skip to content

create-react-app import environment variables helper without REACT_APP prefix helper.

Notifications You must be signed in to change notification settings

AlexanderCollins/env-create-react-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

env-create-react-app Build Status

For those using create-react-app wishing to refrence their .env file variables without the REACT_APP prefix.

Usage

.env file

REACT_APP_MY_ENVIRONMENT_VARIABLE_A=foo
REACT_APP_MY_ENVIRONMENT_VARIABLE_B=bar

Example

import {
    MY_ENVIRONMENT_VARIABLE_A,
    MY_ENVIRONMENT_VARIABLE_B
} from 'env-create-react-app';

console.log(MY_ENVIRONMENT_VARIABLE_A);
console.log(MY_ENVIRONMENT_VARIABLE_B);

Output

foo
bar

About

create-react-app import environment variables helper without REACT_APP prefix helper.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published