Babel 6 regeneratorRuntime is not defined

前端 未结 30 1896
暖寄归人
暖寄归人 2020-11-22 03:49

I\'m trying to use async, await from scratch on Babel 6, but I\'m getting regeneratorRuntime is not defined.

.babelrc file

{
    \"presets\": [ \"es2         


        
30条回答
  •  忘了有多久
    2020-11-22 04:37

    Update your .babelrc file according to the following examples, it will work.

    If you are using @babel/preset-env package

    {
      "presets": [
        [
          "@babel/preset-env", {
            "targets": {
              "node": "current"
            }
          }
        ]
      ]
    }
    or if you are using babel-preset-env package
    
    {
      "presets": [
        [
          "env", {
            "targets": {
              "node": "current"
            }
          }
        ]
      ]
    }
    

提交回复
热议问题