regeneratorRuntime is not defined



I want to use Websockets in my website, so I read the related topic in AdonisJs documentations.
but some of it’s descriptions are not clear to me. according to docs:

and then import it as follows

import Ws from '@adonisjs/websocket-client'
const ws = Ws('ws://localhost:3333')

Where should I use this line of code ? ( front ? backend ? )

import Ws from '@adonisjs/websocket-client' 

because as far as I know import is es6 syntax and it’s not supported well in browsers.

or this

The module build requires regenerator-runtime polyfill, so make sure to add it via babel.

I installed it, but don’t know how to use it.

Can someone please help me.


If you are using Babel and webpack, you can get import working.

Are you using webpack and babel?

  1. If no, then you can use the CDN build
  2. If yes, then read this Adonis web socket client and vue js 3


If it is an angular 6/7 project look at this Error Integrating Adnoisjs websocket Client API with angular7