kefirjs / kefir

A Reactive Programming library for JavaScript
https://kefirjs.github.io/kefir/
MIT License
1.87k stars 97 forks source link

can't access fromEvents when using es6 imports #223

Closed micahscopes closed 7 years ago

micahscopes commented 7 years ago
import { fromEvents } from 'kefir'

gives me Export 'fromEvents' is not defined by '.../node_modules/kefir/dist/kefir.js'

Just to see what'd happen, I tried doing:

import * as kefir from 'kefir'

kefir.fromEvents(...)

and that just resulted in kefir.fromEvents being undefined.

rpominov commented 7 years ago

Does it work for other methods? For example import {stream} from 'kefir'?

Edit: replaced create -> stream

micahscopes commented 7 years ago

yeah, I tried it with stream and that worked.

On Thu, Oct 13, 2016 at 2:26 PM, Roman Pominov notifications@github.com wrote:

Does it work for other methods? For example import {create} from 'kefir'?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rpominov/kefir/issues/223#issuecomment-253613341, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXylmjuU9q2GKoShh4XK0C5or8BqutLks5qzoXWgaJpZM4KWOC- .

rpominov commented 7 years ago

I tried it with rollup and it doesn't work with any method. Not sure if it should actually, maybe rollup doesn't support this kind of imports from a cjs module. import Kefir from 'kefir' works fine in my setup though.

Are you sure it works for other methods, and what bundler do you use webpack/rollup/browserify?

micahscopes commented 7 years ago

ahh, just realized I'm using the rollup-plugin-commonjs plugin. that definitely explains why it did anything at all. I just need to figure out the correct way of importing.

so I'll try import Kefir from 'kefir'

thanks

rpominov commented 7 years ago

Ok, I'll close this for now then.