Crisostomo Ibarra
Crisostomo Ibarra

Reputation: 77

REACT_EDITOR=atom ERR

My console keeps on saying that "To set up the editor integration, add something like REACT_EDITOR=atom to the .env.local file in your project folder and restart the development server. Learn more"

I cant even find the .env file on my create-react-app.

Thank you in advance.

Upvotes: 3

Views: 11730

Answers (1)

giraffesyo
giraffesyo

Reputation: 5342

Create-React-App supports custom environment variables.

The documentation discusses how to declare these variables:

This can be done using two ways: either in your shell or in a .env file. Both of these ways are described in the next few sections.

Through the local environment

The first way is to add it to your local environment:

For instance, if you're using bash, edit ~/.bashrc

Add export REACT_APP_EDITOR=atom to the bottom then restart your terminal (or source ~/.bashrc)

Through .env files in your application

The second way is to create a .env file at the root of your application directory, and add the variable on a single line there:

REACT_APP_EDITOR=atom

From the documentation, these types of files can be declared and will be consumed by Create-React-App:

.env: Default.
.env.local: Local overrides. This file is loaded for all environments except test. .env.development, .env.test, .env.production: Environment-specific settings.
.env.development.local, .env.test.local, .env.production.local: Local overrides of environment-specific settings.

Upvotes: 6

Related Questions