Babel 6 regeneratorRuntime is not defined

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

    I had this problem in Chrome. Similar to RienNeVaPlu͢s’s answer, this solved it for me:

    npm install --save-dev regenerator-runtime
    

    Then in my code:

    import 'regenerator-runtime/runtime';
    

    Happy to avoid the extra 200 kB from babel-polyfill.

提交回复
热议问题