'regeneratorRuntime is not defined' whem requiring
opened this issue · comments
Hello,
This is pretty self explanatory I hope:
> require('lmdb-leveldown')
Thrown:
ReferenceError: regeneratorRuntime is not defined
at /home/lewis/dbtest/node_modules/lmdb-leveldown/build/index.js:450:47
at /home/lewis/dbtest/node_modules/lmdb-leveldown/build/index.js:513:4
Node version v10.16.0. Downloads fine, I can require node-lmdb no problem.
At the moment, lmdb-leveldown expects to be run in a system with regeneratorRuntime defined. You can install regenerator-runtime
and use it as a polyfill by running the following before importing lmdb-leveldown to fix this issue for now:
import 'regenerator-runtime/runtime';
import leveldown from 'lmdb-leveldown';
I'll leave this issue open for now, since it would be somewhat of a better dev experience to not have to do this. I may not get to fixing it anytime soon though.
below is mostly notes for me when I come back to this
It's not a super quick fix on this side because I'm using chrbala-rollup which doesn't allow for babel overrides right now, and I don't want to transform async functions in all contexts. Basically the babel config here just needs to include babel-plugin-transform-async-to-generator and this should work without extra config, but it'll add a bit of JS weight to the output.