Create-React-App failed to compile | Import/First Error

前端 未结 7 2046
有刺的猬
有刺的猬 2021-01-02 09:22

I\'m currently using Create-React-App for my personal site. I keep getting the following errors every time I run it:

./src/~/react-router-dom/es/index.js
 Li         


        
7条回答
  •  青春惊慌失措
    2021-01-02 09:31

    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';

提交回复
热议问题