Skip to content

Using dotenv .env config file correctly #865

Description

@lovegrovegeorge

Description

How the .env file and imports should be setup for the project correctly as currently the build is breaking.

Expected behavior

  • add .env file with config in root
  • npm install --save dotenv
  • import dotenv using require('dotenv').config(); or ES6 syntax in index.js file
  • consume using process.env.CONFIG_NAME across application

Actual behavior

screen shot 2016-10-06 at 17 45 24

Using the expected behaviour approach I get the above error. I've also tried both installing dotenv and not installing it (as ejecting the repository shows dotenv is already a dependency).

Environment

react-scripts@0.6.1
node - v6.6.0
npm - 3.10.8

Using a Chrome (53.0.2785.143) on a Mac.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions