在Vue-cli 3中添加Flow.js

时间:2018-10-18 15:10:23

标签: vue-cli-3 flow-js

尝试将Flow.js添加到现有项目中时出现编译错误:

我得到了正确的运行状态(安装了软件包并运行了init流程),所以这里没有问题:

npm run flow 

但是

npm run start

失败,出现编译问题

Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In /home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/babel-preset-flow/lib/index.js
    at createDescriptor (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/config-descriptors.js:162:11)
    at items.map (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/config-descriptors.js:87:50)
    at Array.map (<anonymous>)
    at createDescriptors (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/config-descriptors.js:87:29)
    at createPresetDescriptors (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/config-descriptors.js:79:10)
    at presets (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/config-descriptors.js:61:19)
    at presets (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/config-descriptors.js:51:25)
    at mergeChainOpts (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/config-chain.js:308:26)
    at /home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/config-chain.js:271:7
    at buildRootChain (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/config-chain.js:90:20)
    at loadPrivatePartialConfig (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/partial.js:51:55)
    at Object.loadPartialConfig (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/@babel/core/lib/config/partial.js:74:18)
    at Object.<anonymous> (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/babel-loader/lib/index.js:82:26)
    at Generator.next (<anonymous>)
    at step (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/babel-loader/lib/index.js:3:221)
    at _next (/home/yaniv/Jeeng-Workspace/dashboard-v3/node_modules/babel-loader/lib/index.js:3:409)

babel.config.js(仅供参考)

module.exports = {
  presets: [
    "flow",
    [
      ("@vue/app",
      {
        useBuiltIns: "entry"
      })
    ]
  ]
};

0 个答案:

没有答案