Babel 6 regeneratorRuntime is not defined

前端 未结 30 1859
暖寄归人
暖寄归人 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:14

    To babel7 users and ParcelJS >= 1.10.0 users

    npm i @babel/runtime-corejs2
    npm i --save-dev @babel/plugin-transform-runtime @babel/core
    

    .babelrc

    {
      "plugins": [
        ["@babel/plugin-transform-runtime", {
          "corejs": 2
        }]
      ]
    }
    

    taken from https://github.com/parcel-bundler/parcel/issues/1762

提交回复
热议问题