How to enable async/await with babel with support for IE11

后端 未结 1 623
一整个雨季
一整个雨季 2021-01-19 04:20

I am hoping to use async/await in my source code and have it transpiled by babel to something useable by >0.25% not dead.

My head is spinning with th

相关标签:
1条回答
  • 2021-01-19 05:19

    If you only need the generator polyfill — which is needed for async/await — then you can just use facebook/regenerator.

    You could follow the steps to support async/await in IE 11:

    • use babel-preset-env
    • yarn add regenerator or npm install regenerator
    • add node_modules/regenerator-runtime/runtime.js (10.7kb minified) into your bundle

    Reference link: Add ES7 Async/Await Support for your Webapp in 3 Easy Steps

    0 讨论(0)
提交回复
热议问题