React injecting iframe with max z-index on reload after changes (development)

This is actually a known bug in react-scripts, which is used in create-react-app. They’re apparently working on a fix for react-scripts v5.0.1, but adding the following lines to your package.json will fix it: “resolutions”: { “react-error-overlay”: “6.0.9” } So your package.json should look something like this: { “name”: “whatever”, “version”: “0.1.0”, “private”: true, “dependencies”: { … Read more

How to create and run a development build of an application using create-react-app configuration

This is not really doable with just create-react-app, there is an open issue Here and it doesn’t look like it will be added anytime soon. However, you can use a package called dotenv for that, following are the steps you should take: Install dotenv (make sure to add save dev) npm install dotenv-cli –save-dev In … Read more

Enabling CORS in Create React App utility

If you are needing this for development and wanting to access an api from your react app but getting an error like this- Failed to load http://localhost:8180/tables: The ‘Access-Control-Allow-Origin’ header has a value ‘http://localhost:8180’ that is not equal to the supplied origin. Origin ‘http://localhost:3000’ is therefore not allowed access. Have the server send the header … Read more

How can remove console.log in the production build of a React application created using create-react-app?

I am using this approach to avoid ejecting react-scripts if (process.env.NODE_ENV === ‘production’) { console.log = () => {} console.error = () => {} console.debug = () => {} } index.js import React from ‘react’ import ReactDOM from ‘react-dom’ import App from ‘./App’ import ‘./styles/main.scss’ // replace console.* for disable log on production if (process.env.NODE_ENV … Read more

Failed to load plugin import: ‘eslint-plugin-import’

The issue is resolved for me after installing the following in a row: npm install eslint-plugin-import eslint-plugin-flowtype eslint-plugin-jsx-a11y eslint-plugin-react Have you tried installing eslint locally, like npm install eslint-plugin-import –save-dev ? Edit -Solution: Instead of installing eslint packages one after another, the problem can be alleviated by npm install react-scripts as react-scripts is taking care … Read more

How to use environment variables in Github Page?

Edited June 2020 Reference @alicia-jasmine “React is purely a front-end framework. Everything accessible to React (even if you embed it through a build step) will later be visible in the front-end code and someone relatively basic to find. To really keep them secret you MUST have something server side!” The following answer will actually expose … Read more

google is not defined in react app using create-react-app

As mentioned in the user guide, you need to explicitly read any global variables from window. Put this at the top of the file and it will work: const google = window.google; The reason we enforce this is because people commonly misunderstand the difference between local variables, imported modules, and global variables, and so we … Read more