Create-React-App failed to compile | Import/First Error
For me, it was a case, because I was violating Eslint import/first rule, by calling an imported function before any other import.
For example, this code had a problem:
import configureStore from './redux/common/configureStore';
const store = configureStore();
// Add polyfill for fetch for older browsers
import 'isomorphic-fetch';
require('es6-promise').polyfill();
because I was calling and assigning const store = configureStore();
before import 'isomorphic-fetch';
This is because you accidentally installed React Router into src
folder. So the linter thinks it’s your code and tries to validate it. Don’t install third party dependencies inside src
.
Delete src/node_modules
and run npm install
in the root folder of your app. If some package is missing, run npm install --save <package-name>
, also in the root folder.