Babel 6 regeneratorRuntime is not defined

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

    Babel 7 Users

    I had some trouble getting around this since most information was for prior babel versions. For Babel 7, install these two dependencies:

    npm install --save @babel/runtime 
    npm install --save-dev @babel/plugin-transform-runtime
    

    And, in .babelrc, add:

    {
        "presets": ["@babel/preset-env"],
        "plugins": [
            ["@babel/transform-runtime"]
        ]
    }
    

提交回复
热议问题