[英]Webpack can't parse a javascript file using the “flow type checker”
Though I tried all babel presets and plugins I found on google, my webpack can not parse the javascript files using the facebook's "flow type checker". 尽管我尝试了所有在google上找到的babel预设和插件,但我的webpack无法使用facebook的“流类型检查器”解析javascript文件。
The error I get : 我得到的错误 :
ERROR in ./~/mapbox-gl/src/geo/transform.js
Module parse failed: /home/project/project-repo/Vee/superset/assets/node_modules/mapbox-gl/src/geo/transform.js Unexpected token (22:12)
You may need an appropriate loader to handle this file type.
| */
| class Transform {
| tileSize: number;
| tileZoom: number;
| lngRange: ?[number, number];
@ ./~/react-map-gl/dist/utils/transform.js 11:17-54
@ ./~/react-map-gl/dist/map.react.js
@ ./~/react-map-gl/dist/index.js
@ ./~/react-map-gl/index.js
@ ./visualizations/mapbox.jsx
@ ./visualizations/main.js
@ ./javascripts/modules/superset.js
@ ./javascripts/dashboard/Dashboard.jsx
@ multi babel-polyfill ./javascripts/dashboard/Dashboard.jsx
My webpack config rule : 我的webpack配置规则 :
{
test: /\.js$/,
exclude: APP_DIR + '/node_modules/',
use: [{
loader:'babel-loader',
options:{
presets:[
'airbnb',
'es2015',
"stage-2",
"flow"
],
plugins:[
"transform-flow-strip-types",
"transform-flow-comments"
]
}
}],
},
My .babelrc file: 我的.babelrc文件:
{
"presets" : ["airbnb", "es2015", "react","flow"],
"plugins": ["async-to-promises","transform-flow-strip-types","transform-flow-comments"]
}
Sounds like that module is using a super hacky approach to integrating Flowtype. 听起来该模块正在使用一种超级hacky方法来集成Flowtype。 Seems like you're hitting something like https://github.com/uber/react-map-gl/issues/179 which uses this logic: https://github.com/uber/react-map-gl/pull/192/files 好像你打像https://github.com/uber/react-map-gl/issues/179使用这种逻辑: https://github.com/uber/react-map-gl/pull/ 192 /文件
I'd recommend filing a bug with them. 我建议向他们提交错误。 This shouldn't be your responsibility to handle via Webpack. 这不是您通过Webpack处理的责任。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.