原因是这样的:

我把一个组件分为三个文件,

               |—Home.jsx         //  业务逻辑与html
Home——|—Home.css // 样式
|—index.js // 引入Home.css ,再把Home组件暴露出去

其中index.js是对Home.js 的导出,和对Home.css的导入,代码是这样的:

export { default } from "./Home.jsx";
import "./Home.css";

于是,,,,于是,就报错啦, 以前这样写也没问题的呀,google搜搜说是因为这个:

import 必须在其它所有业务代码前面(eslint 暴出),

异步组件导入了 也不能插在其他导入的东西前面,

类似的行为都会报这个错误

改成这样就好啦:

import "./Home.css";
export { default } from "./Home.jsx";

好吧,我这儿其实就是调换个位置~

react编译报错:Import in body of module; reorder to top import/first的更多相关文章

  1. maven项目编译报错:Type Dynamic Web Module 3.0 requires Java 1.6 or newer.

    在maven的pom.xml文件中增加: <build>   <plugins>     <plugin>         <groupId>org.a ...

  2. react+typescript报错集锦<持续更新>

    typescript报错集锦 错误:Import sources within a group must be alphabetized.tslint(ordered-imports) 原因:impo ...

  3. iOS二维码生成-libqrencode编译报错

    libqrencode使用 1.将libqrencode文件夹整个拖入项目文件夹中 2.在要生成二维码的页面的 .m文件头部添加 #import "QRCodeGenerator.h&quo ...

  4. webStrom中React语法提示,React语法报错处理

    1,webStrom中React语法报错 ①, 取消Power Save Mode的勾选 File——Power Save Mode ②,webstorm开发react-native智能提示 随便在一 ...

  5. Spark程序编译报错error: object apache is not a member of package org

    Spark程序编译报错: [INFO] Compiling 2 source files to E:\Develop\IDEAWorkspace\spark\target\classes at 156 ...

  6. 使用C#模拟Outlook发送邮件,代码编译报错

    添加OutLook API using OutLook = Microsoft.Office.Interop.Outlook; 发送邮件方法 public void SendEmail() { Out ...

  7. cordova编译报错:Execution failed for task ':processDebugResources'

    cordova编译报错:Execution failed for task ':processDebugResources' 引发这个错误的最扩祸首就是一个中文命名的文件,不知道什么时候加入的,我写了 ...

  8. 编译报错dereferencing pointer to incomplete type

    关于编译报错“dereferencing pointer to incomplete type... 多是没找到结构体的定义,可以在本地复制其定义试试. 参考: http://my.oschina.n ...

  9. Maven-010-maven 编译报错:Failure to ... in ... was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced.

    今晚在编译 maven 项目的时候,命令行报错,出现 Failure to ... in ... 类似错误,详细的错误信息如下所示: [INFO] -------------------------- ...

随机推荐

  1. Listener监听器和Filter过滤器

    Listener监听器 WEB中的监听器 WEB 中的 Listener 和 Filter 是属于 Servlet 规范中的高级的技术.WEB中的监听器共有三类八种(监听三个域对象)* 事件源:Ser ...

  2. win10 python3.5 自动补全设置

    https://www.cnblogs.com/lgh344902118/p/8521437.html # python startup file import readline import rlc ...

  3. HTML学习笔记Day7

    一.position定位属性,检索对象的定位方式 1.语法:{position:static(无特殊定位)/absolute(绝对定位)/relative(相对定位)/fixed(固定定位):} 1) ...

  4. linux 进程创建clone、fork与vfork

    目录: 1.clone.fork与vfork介绍 2.fork说明 3.vfork说明 4.clone说明5.fork,vfork,clone的区别 内容: 1.clone.fork与vfork介绍 ...

  5. Luogu P2852 [USACO06DEC]牛奶模式Milk Patterns

    题目链接 \(Click\) \(Here\) 水题.利用\(Height\)的性质维护一个单调栈即可. #include <bits/stdc++.h> using namespace ...

  6. (二叉树 BFS DFS) leetcode 104. Maximum Depth of Binary Tree

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  7. 学习笔记(node.js)

    因为做的笔记太多了,所以就直接发到百度云盘了. 第一天:是关于环境的配置,以及简单的练习. 云盘链接地址:链接:https://pan.baidu.com/s/1WLWtyTKWaQ32JpDUCF2 ...

  8. python 面向对象(六)MRO C3算法 super

    ########################总结################ 面向对象回顾 类:对某一个事物的描述,对一些属性和方法的归类 class 类名: var=123#类变量 def ...

  9. cocos-2dx 3.17 环境搭建 与 新建工程

    由于上次在ubuntu中安装了cocos2dx的时候环境被破坏了,所以本文是基于 Windows 编写的 平台: OS : windows 10 compiler   : VS 2015 下载 coc ...

  10. centos nginx gerrit

    gerrit官方地址:https://www.gerritcodereview.com/ 需先安装依赖  jdk mysql 并手动创建数据库 下载好war包后,初始化操作 java -jar ger ...