env-create-react-app

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

Usage no npm install needed!

<script type="module">
  import envCreateReactApp from 'https://cdn.skypack.dev/env-create-react-app';
</script>

README

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