javascript - 构建反应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 | });
解决方案
您可以安装babel-brunch和一个包含扩展语法和类属性的预设,例如stage-2
预设。
推荐阅读
- html - 卡片布局中的内容在移动视图中不会缩小
- java - 多个 Spring @RequestMapping 标头
- javascript - 在 Eclipse Photon 中使用 async/await 验证错误
- c# - 三层c#asp.net数据库应用中OOP的正确使用
- spring-boot - Spring Boot 嵌入式 TomCat 添加执行器后无法启动
- amazon-cloudformation - 在 Cloudformation 中创建 Application Load Balancer 时出错... XXXXX 必须是 ARN 格式
- javascript - 数组内容未在 ReactJS 中呈现
- c# - 在c#中打破骆驼案例功能
- swift - 如果通过 selectedIndex 属性进行更改,则更改视图时的动画将无法正常工作
- python - Python:用项目列表替换列表中的项目