1. 程式人生 > >今天遇到一個坑,react專案報錯 ,line 9 : Absolute imports should come before relative imports

今天遇到一個坑,react專案報錯 ,line 9 : Absolute imports should come before relative imports

首現看這個錯誤的名稱,第九行的匯入應該在相關匯入之前,這行程式碼是

import { HashRouter as Router, Switch, Redirect, Route } from 'react-router-dom'; 修改方式,將改行程式碼放在匯入react程式碼後面也是第二行: import  React, { Component }  from 'react'; import { HashRouter as Router, Switch, Redirect, Route } from 'react-router-dom';   我在這兩行中間新增其他資源,就報這個錯了,無語