B
B
Bogdan2018-02-26 12:08:59
Vue.js
Bogdan, 2018-02-26 12:08:59

Error on async await?

Hello. When used in a method, acync throws an error

const logIn = async ( ) => {
        console.log( 11 );
      }

LogIn.vue?3e21:66 Uncaught ReferenceError: regeneratorRuntime is not defined
at eval (LogIn.vue?3e21:66)
at VueComponent.onSubmit (LogIn.vue?3e21:69)
at Proxy.boundFn (vue.esm.js?efeb :190)
at submit (LogIn.vue?6bb8:17)
at invoker (vue.esm.js?efeb:2004)
at HTMLFormElement.fn._withTask.fn._withTask (vue.esm.js?efeb:1802)

.babelrc
{
  "presets": [
    ["env", { "modules": false } ],
    "stage-3"
  ],
  "plugins": ["syntax-dynamic-import"]
}

Please tell me how to fix this?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
P
prudcky, 2019-05-05
@prudcky

When working with webpack, I solved this problem
by installing babel-polyfill
in the webpack config

require('babel-polyfill');
module.exports = {
  // BASE config
  externals: {
    paths: PATHS
  },
  entry: {
    app: ['babel-polyfill', PATHS.src]
  }, ...

B
Bogdan, 2018-02-26
@bogdan_uman

Googled and found the

{
  "presets": [
    "es2017",
    "stage-3"
  ],
  "plugins": [ "syntax-dynamic-import" ]
}

A
Anton Shvets, 2018-02-26
@Xuxicheta

https://stackoverflow.com/questions/33527653/babel...

A
avprinciple, 2020-08-17
@avprinciple

plugins: [
  ['@babel/transform-runtime']
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question