react-love/react-latest-framework

读取jsx文件报错

henry1992007 opened this issue · 1 comments

项目有个依赖 hermes-treeselect,这个依赖的index文件格式是jsx,引入依赖后会报错

ERROR in ./~/hermes-treeselect/src/async/index.jsx
Module parse failed: /Users/jianheng.he/workspace/static/marketing-form-builder/node_modules/hermes-treeselect/src/async/index.jsx Unexpected token (22:22)
You may need an appropriate loader to handle this file type.
| 
| class Tree extends Component {
|   static defaultProps = {
|     onExpand: noop,
|     onCheck: noop,
 @ ./~/hermes-treeselect/asynctree.jsx 1:0-46
 @ ./src/components/FormBuilder/comps/SelectCustomers.js
 @ ./src/components/FormBuilder/elementMap.js
 @ ./src/components/FormBuilder/Stage.js
 @ ./src/containers/FormBuilder/FormBuilderContainer.js
 @ ./src/appContainer.js
 @ ./src/index.js
 @ multi babel-polyfill ./src/index webpack-hot-middleware/client?path=http://localhost:3011/__webpack_hmr&reload=true&noInfo=false&quiet=false

尝试添加react-loader到webpack配置里面试试。

rules: [
      {test: /\.jsx$/, use: 'react-loader'}
    ]