-
-
Notifications
You must be signed in to change notification settings - Fork 267
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
[question] Levelup, React and ES6? #619
Comments
import levelup from 'levelup' Should work. It's not an ES6 module, so you can't do tree shaking etc, but it works. |
Thanks! Now I feel a bit embarrassed for not just trying it :) |
No worries! Good to close? |
Yes! :)
…--
Apologies for brevity- this message was sent from my mobile
On 22 Nov 2018, at 13:19, Vincent Weevers ***@***.***> wrote:
No worries! Good to close?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@vweevers I've been banging on this off and on for a few weeks now, and I still can't get Frontend build tools are a bit of a rabbit hole, and I am no expert- so perhaps there is somebody here who knows the exact incantation to get Either way, some documented way to make Until then: maybe reopen this issue or one that is similar? |
@fergiemcdowall could you provide a minimal example repo that we can install and (try to) run? |
The feature you're missing is browserify/browserify#1186, correct? Or is it about more than just imports? |
It seems |
@vweevers thanks for taking the time to throw that example together so quickly! Yes, your example using (The current |
To be clear, before |
Also works: https://github.com/vweevers/level-with-webpack-test/tree/levelup |
And |
If you take ERROR in ./node_modules/bindings/bindings.js
Module not found: Error: Can't resolve 'fs' in '/Users/fergusmcdowall/projects/node/level-with-webpack-test/node_modules/bindings'
@ ./node_modules/bindings/bindings.js 6:9-22
@ ./node_modules/leveldown/leveldown.js
@ ./node_modules/level/level.js
@ ./index.js |
|
Sorry- mispoke- I also get a bindings.js related error with level-browserify in rollup, and level@next. Quite possible that this is more to do with my limited understanding of Rollup than any actual problem. |
In any case- that it works in webpack solves my usecase |
Ah okay. So Rollup is the problem. Good to know! I'm not sure if that is something we can fix on our end, so if and when someone wants to tackle that we can discuss it in a new issue. Thanks! |
For sure 👍 Now we have an example that demonstrates "compile Level for browser", and that should be good enough for most users regardless of compiler. Cheers! |
Like many Front End Engineers I have to do everything in React these days.
One of the great things about
levelup
is that you can pair it withlevel-js
in order to run it in a browser. Up until now I have being doing this by making node-style React apps withrequire
and then browserifying everything.However since React uses ES6 modules by default, it seems like the best way to incorporate a levelup instance into a browser app would be to somehow get it as an ES6 module. This would have the advantage that it could be plugged straight into the supported tooling that comes from the React project
So- is
levelup
available as an ES6 module?The text was updated successfully, but these errors were encountered: