简体   繁体   English

Webpack无法使用“流类型检查器”解析JavaScript文件

[英]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.

相关问题 Flow的“JQuery接口文件”(来自Facebook的JavaScript静态类型检查器)? - “JQuery Interface file” for Flow (Static Type Checker for JavaScript from Facebook)? 流javascript类型检查器中的函数类型是什么? - What is the type of function in flow javascript type checker? 使用Appcelerator无法获取JSON文件以将其解析为JavaScript中的TableView - Can't get JSON file to parse into TableView in JavaScript using Appcelerator 在库定义中导入(流类型/)在流中不起作用(静态类型检查器) - Importing in library definition (flow-typed/) doesn't work in flow (static type checker) JavaScript 的类型检查器? - Type checker for JavaScript? node_modules/* 中的流类型检查器错误 - Flow type checker errors in node_modules/* 我无法使用Javascript使用JSON进行解析 - I can't parse using JSON using Javascript 为什么我不能用Javascript打开()和解析()这个JSON文件? - Why can't I open() and parse() this JSON file in Javascript? 无法解析JavaScript字符串中的\\ - Can't parse \ in strings in javascript 流程Javascript“ T的缺少类型注释”和“ S的缺少类型注释” - Flow Javascript “Missing type annotation for T” And “Missing type annotation for S”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM