首页 > 解决方案 > 构建反应js时早午餐构建工具错误

问题描述

使用早午餐构建构建反应组件时出现错误。这个错误是关于什么的?

 error: Compiling of js/assets/jss/material-dashboard-pro-react/views/userProfileStyles.jsx failed. L5:4 js/assets/jss/material-dashboard-pro-react/views/userProfileStyles.jsx: Unexpected token 
     3 |   cardTitle,
     4 |   cardIconTitle: {
   > 5 |     ...cardTitle,
       |     ^
     6 |     marginTop: "15px",
     7 |     marginBottom: "0px",
     8 |     "& small": {

也得到了这个错误

14:44:44 - error: Compiling of js/components/Accordion/Accordion.jsx failed. L22:15 Unexpected token 
     20 |     };
     21 |   }
   > 22 |   handleChange = panel => (event, expanded) => {
        |                ^
     23 |     this.setState({
     24 |       active: expanded ? panel : -1
     25 |     });

标签: javascriptreactjsbrunch

解决方案


您收到传播语法类属性的错误。

您可以安装babel-brunch和一个包含扩展语法和类属性的预设,例如stage-2预设


推荐阅读