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

前端 未结 7 2002
有刺的猬
有刺的猬 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条回答
  •  旧时难觅i
    2021-01-02 09:34

    In my case, I got this error for the below piece of code. Before fix:-

    import axios from 'axios';
    export const GET_TODO = 'GET TODO';
    export const SAVE_TODO = 'SAVE TODO';
    import { devConstants } from 'src/appConstants';
    

    After spending some time on this, I am able to find cause for this." all import statements should be at the top of the module,"

    After fix:-

    import axios from 'axios';
    import { devConstants } from 'src/appConstants';
    
    export const GET_TODO = 'GET TODO';
    export const SAVE_TODO = 'SAVE TODO';
    

提交回复
热议问题