React项目抛错: Import in body of module; reorder to top import/first

  • 21,605 views
  • 阅读模式
React项目编译后,在Chrome中调试,抛出以下错误:Import in body of module; reorder to top import/first

发现代码中 import axios from "axios" 前面有一行 const常亮定义, 把import移到const前面就正常了

原因:import (导入文件)必须在其它所有业务代码的前面

IT老五
  • 本文由 发表于 2020-10-30 16:27:22
  • 转载请务必保留本文链接:https://itlao5.com/4877.html
评论  0  访客  0
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定