Hi!
I wanted to use Observables and I get Uncaught ReferenceError: require is not defined
at
var Rx = require("rxjs");
in my bundle.
This is what I did:
I thought https://github.com/LukaJCB/purescript-rxps is the most recent package.
Just to see if it works
import RxJS.Observable (Observable, fromArray, subscribeNext)
main :: Effect Unit
main = do
liftEffect ((fromArray [ "1", "2", "3", "4", "5" ]) # subObservable)
log "Hello from PureScript!"
subObservable :: Observable String -> Effect Unit
subObservable obs = do
sub <- extract (obs # subscribeNext log)
pure unit
bundled with
spago bundle-app --main Main --to dist/Main.js
and called from the browser with
<script type="text/javascript" src="../dist/Main.js"></script>
What did I do wrong? And can I get away without manually hacking my bundle?
Thanks.