这是我的Redux应用程序中的一行:
export default connect<Props, OwnProps, _, _, _, _>(mapStateToProps, mapDispatchToProps)(MyComponent)
但是,Webpack在构建捆绑包时会引发错误:
ERROR in ./static/react/content_block_editor/EditorMain.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token, expected ; (287:28)
我应该安装什么来解决此问题?
我的package.json
依赖项:
"dependencies": {
"axios": "^0.16.2",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"brace": "^0.10.0",
"clean-webpack-plugin": "^0.1.16",
"connection-line": "^1.1.6",
"css-loader": "^0.28.7",
"eventing-bus": "^1.3.3",
"filepond": "^3.3.0",
"filepond-plugin-image-crop": "^2.0.0",
"filepond-plugin-image-preview": "^3.1.3",
"filepond-plugin-image-transform": "^3.0.3",
"history": "^4.7.2",
"informed": "^1.10.7",
"lodash": "^4.17.11",
"mime-types": "^2.1.21",
"moment": "^2.22.2",
"node-sass": "^4.9.4",
"npm": "^6.4.1",
"prop-types": "^15.6.2",
"query-string": "^6.1.0",
"rc-menu": "^7.4.19",
"react": "^16.7.0",
"react-ace": "^5.2.0",
"react-bootstrap": "^0.31.5",
"react-cookie": "^2.1.1",
"react-dnd": "^5.0.0",
"react-dnd-html5-backend": "^5.0.1",
"react-dom": "^16.7.0",
"react-draggable": "^3.0.5",
"react-dropdown": "^1.6.2",
"react-filepond": "^5.0.0",
"react-input-mask": "^1.0.7",
"react-paginate": "^5.2.4",
"react-redux": "^5.0.7",
"react-responsive-modal": "^3.4.0",
"react-router-dom": "^4.3.1",
"react-select": "^1.3.0",
"react-switchery": "^1.2.3",
"react-tagsinput": "^3.19.0",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"sass-loader": "^7.1.0",
"styled-components": "^4.1.3",
"uuid": "^3.3.2",
"webpack-bundle-tracker": "^0.3.0",
"@storybook/addon-actions": "^4.1.3",
"@storybook/addon-console": "^1.1.0",
"@storybook/addon-knobs": "^4.1.3",
"@storybook/react": "^4.1.3",
"babel-plugin-styled-components": "^1.10.0",
"babel-preset-flow": "^6.23.0",
"empty": "^0.10.1",
"flow-bin": "^0.89.0",
"flow-typed": "^2.5.1",
"flow-webpack-plugin": "^1.2.0",
"jest": "^23.6.0",
"redux-devtools-extension": "^2.13.7",
"style-loader": "^0.23.1",
"webpack": "^4.28.0",
"webpack-cli": "^3.1.2"
}
我的.babelrc
:
{
"presets": ["react", "es2015", "stage-0", "flow"],
"plugins": ["babel-plugin-styled-components"]
}