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

前端 未结 7 1896
有刺的猬
有刺的猬 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:54

    If you're here because you were using React.lazy to lazy load a component, you must specify all your import statements before any React.lazy() lines. Another way of saying this is, you cannot have any import statements after your lazy loaded components.

    See example for order

    import Footer from "./components/Footer.js";
    const Header = React.lazy(() => import("components/Header"));
    
    0 讨论(0)
提交回复
热议问题