【问题标题】:build failed due to babelrc, presets[0] [1] must be an object, false or undefined由于 babelrc,构建失败,presets[0] [1] 必须是一个对象,false 或 undefined
【发布时间】:2020-06-10 09:33:42
【问题描述】:

我在使用 babel 时遇到问题。我正在尝试在我的应用程序中使用 async/await,为此我需要在 babelrc 中添加 node 选项。 但是,我收到了这个错误:

我检查了这个问题,但我是一个公平的菜鸟,我真的不明白我的问题出在哪里。 Plugins[0][1] must be an object, false, or undefined

我的 babelrc 文件:

{
  "presets": [
    [
      "@babel/preset-env",
      "@babel/preset-react",
      {
        "targets": {
          "node": "10"
        }
      }
    ]
  ]
}

【问题讨论】:

    标签: javascript reactjs webpack babeljs


    【解决方案1】:

    我找到了解决办法:

    {
      "presets": [
        [
          "@babel/preset-env",
          {
            "targets": {
              "node": "10"
            }
          }
        ],
        "@babel/preset-react"
      ]
    }
    

    【讨论】:

    猜你喜欢
    • 2019-11-08
    • 2017-08-29
    • 1970-01-01
    • 2019-03-23
    • 2015-05-28
    • 1970-01-01
    • 2011-03-01
    • 2019-01-26
    • 1970-01-01
    相关资源
    最近更新 更多