Ant design 项目打包后报错:"Menu(or Flex) is not defined"
2018-05-18 11:17
417 查看
我的项目使用了ant-design 和 ant-design-mobile,在测试环境上没问题,但是打包发布之后控制台报错
Menu is not defined
Flex is not defined
经过一番查找,终于发现问题的原因:
我在代码中使用Menu 和 Flex 组件的方式是这样的:
<Menu.Item>xxxx</Menu.Item> <Flex.Item>xxxx</Flex.Item>
打包的时候使用了babel-react-optimize
这个库包含四个子库,会对react代码进行优化,可能是因为其中某个子库对带点的标签如:<Menu.Item>无法识别导致的,具体是哪个我还没找到,因为官方提供的文档也没有说明。
解决方案:
const MenuItem = Menu.Item const FlexItem = Flex.Item <MenuItem>xxx</MenuItem> <FlexItem>xxx</FlexItem>
相关文章推荐
- Android应用项目绑定appcom_v7打包时,出现错误:"XXX"isnottranslatedin"af"(Afrikaans),"am"(Amharic),"ar"(Arabic).....
- Android应用项目绑定appcom_v7打包时,出现错误:"XXX"isnottranslatedin"af"(Afrikaans),"am"(Amharic),"ar"(Arabic).....
- Eclipse下项目警告"Target runtime Apache Tomcat 7.0 is not defined"
- Eclipse下项目警告"Target runtime Apache Tomcat 7.0 is not defined"
- Android 项目打包时报错:"app_name" is not translated in af
- AndroidStudio与eclipse打包的时候报错。Error:(4) Error: "ssdk_instapager_login_html" is not translated in...
- Android studio 打包时报错Error:(5) Error: "xxx" is not translated in "ru-RU" (Russian: Russia) [Mi
- Target runtime Apache Tomcat v7.0 is not defined."
- MyEclipse导入项目报错Target runtime com.genuitec.runtime.generic.jee60 is not defined.
- The run destination "设备名称" is not valid for Running the scheme '项目名称'.
- 错误 the type "xxxx" is defined in an assembly that is not refernced.You must add a reference to assem
- Android Studio打包:“APP_NAME" IS NOT TRANSLATED IN ZH, ZH_CN……..解决办法
- Jenkins编译打包时报错The JAVA_HOME environment variable is not defined correctly + mvn clean package The JA
- Android应用程序打包时,出现错误:"XXX" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic).....
- 聊聊"jQuery is not defined"
- Android应用程序打包时,出现错误:"XXX" is not translated in "af" , "am" , "ar" ....
- when i run server i got "name 'http' is not defined" after import h 4000 ttp.server then i got this "no mo
- APK打包过程中出现Error:"app_name" is not translated in "zh" (Chinese)[Missing Translation]
- MyEclipse导入现成项目后报Target runtime Apache Tomcat v6.0 is not defined. 错误的解决办法
- Android studio打包App报错:Error:(4) Error: "app_name" is not translated in "ar" (Arabic), "cs" (Czech)