kinto.js icon indicating copy to clipboard operation
kinto.js copied to clipboard

ReferenceError: regeneratorRuntime is not defined

Open joezimjs opened this issue 7 years ago • 3 comments

When I include kinto-http.js but don't use any generators or async functions myself, it works just fine, but when I use generators or async functions in my code while using babel-plugin-transform-runtime (I haven't tested with the polyfill instead yet), I get an error: ReferenceError: regeneratorRuntime is not defined which originates from the utils.js file in kinto-http's lib folder.

joezimjs avatar Jul 13 '17 14:07 joezimjs

Yes, we compile our async functions using babel, and I guess it's being transformed into a version that uses regeneratorRuntime. You will need the babel polyfill which provides it. We're not completely sure that we have the packaging right here (see for example https://github.com/Kinto/kinto-http.js/pull/159). I think the best possible thing would be to ship something very close to what's in src/ and rely on whoever is using the code to transpile it as necessary according to their use case. That's part of the reason we don't include babel-polyfill as a dependency right now, although it's not a very good reason. Hope this helps!

glasserc avatar Jul 18 '17 16:07 glasserc

Hi, could you try the new v4.4.1? We changed the packaging a little bit in refreence to some other regeneratorRuntime errors and it may have fixed your problem too.

glasserc avatar Nov 20 '17 21:11 glasserc

Still seeing the error.

joezimjs avatar Nov 21 '17 04:11 joezimjs