Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'regeneratorRuntime is not defined' whem requiring #6

Open
ghost opened this issue Jun 3, 2019 · 1 comment
Open

'regeneratorRuntime is not defined' whem requiring #6

ghost opened this issue Jun 3, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 3, 2019

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.

@chrbala
Copy link
Owner

chrbala commented Jun 3, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant