Babel 6 regeneratorRuntime is not defined

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

    New Answer Why you follow my answer ?

    Ans: Because I am going to give you a answer with latest Update version npm project .

    04/14/2017

    "name": "es6",
     "version": "1.0.0",
       "babel-core": "^6.24.1",
        "babel-loader": "^6.4.1",
        "babel-polyfill": "^6.23.0",
        "babel-preset-es2015": "^6.24.1",
        "webpack": "^2.3.3",
        "webpack-dev-server": "^2.4.2"
    

    If your Use this version or more UP version of Npm and all other ... SO just need to change :

    webpack.config.js

    module.exports = {
      entry: ["babel-polyfill", "./app/js"]
    };
    

    After change webpack.config.js files Just add this line to top of your code .

    import "babel-polyfill";
    

    Now check everything is ok. Reference LINK

    Also Thanks @BrunoLM for his nice Answer.

提交回复
热议问题