create react app not picking up .env files?

I am using create react app to bootstrap my app. I have added two .env files .env.development and .env.production in the root. My .env.development includes: API_URL=http://localhost:3000/api CALLBACK_URL=http://localhost:3005/callback When I run my app using react-scripts start and console out process.env it spits out { NODE_ENV: “development”, PUBLIC_URL: “” } I’ve tried different things, but its just … Read more

npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

I am trying all the ways of creating react application. I have tried with maven and now i am trying with crate-react-app build system from Facebook Incubators. When i tried to run the command create-react-app my-app in npm environment, it worked on my personal system with no issues. But when i tried the same command … Read more

The create-react-app imports restriction outside of src directory

I am using create-react-app. I am trying to call an image from my public folder from a file inside my src/components. I am receiving this error message. ./src/components/website_index.js Module not found: You attempted to import ../../public/images/logo/WC-BlackonWhite.jpg which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either … Read more

What exactly is the ‘react-scripts start’ command?

I’ve been working with a React project using create-react-app and I have two options to start the project: First way: npm run start with the definition at the package.json like this: “start”: “react-scripts start”, Second way: npm start What is the difference between these two commands? And, what is the purpose of the react-scripts start? … Read more

where is create-react-app webpack config and files?

I create a ReactJS project with the create-react-app package and that worked well, but I cannot find webpack files and configurations. How does react-create-app work with webpack? Where are the webpack configuration files located in a default installation with create-react-app? I’m unable to find configuration files in my project’s folders. I have not created an … Read more

How to add fonts to create-react-app based projects?

I’m using create-react-app and prefer not to eject. It’s not clear where fonts imported via @font-face and loaded locally should go. Namely, I’m loading @font-face { font-family: ‘Myriad Pro Regular’; font-style: normal; font-weight: normal; src: local(‘Myriad Pro Regular’), url(‘MYRIADPRO-REGULAR.woff’) format(‘woff’); } Any suggestions? — EDIT Including the gist to which Dan referring in his answer … Read more

Trying to use fetch and pass in mode: no-cors

I can hit this endpoint, http://catfacts-api.appspot.com/api/facts?number=99 via Postman and it returns JSON Additionally I am using create-react-app and would like to avoid setting up any server config. In my client code I am trying to use fetch to do the same thing, but I get the error: No ‘Access-Control-Allow-Origin’ header is present on the requested … Read more

Template not provided using create-react-app

When I type the create-react-app my-app command in my terminal, it appears to work – downloading all libraries successfully etc. At the end of that process however I get a message that a template was not provided. Input user@users-MacBook-Pro-2 Desktop% create-react-app my-app Output Creating a new React app in /Users/user/Desktop/my-app. Installing packages. This might take … Read more