This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-10
Channels
- # beginners (97)
- # boot (77)
- # cider (7)
- # cljs-dev (47)
- # cljsrn (3)
- # clojure (125)
- # clojure-austin (5)
- # clojure-dusseldorf (1)
- # clojure-italy (4)
- # clojure-russia (91)
- # clojure-spec (80)
- # clojure-uk (54)
- # clojurescript (92)
- # core-async (6)
- # cursive (17)
- # datomic (56)
- # hoplon (7)
- # immutant (3)
- # liberator (3)
- # luminus (4)
- # off-topic (26)
- # om (41)
- # om-next (11)
- # pedestal (3)
- # perun (3)
- # protorepl (25)
- # re-frame (32)
- # reagent (33)
- # ring (46)
- # rum (3)
- # spacemacs (5)
- # specter (82)
- # test-check (16)
- # untangled (8)
- # yada (26)
Can anyone suggest why I can’t target :nodejs when building cljsjs.react dependant app? I get
Error: Cannot find module ‘react’`
thrown from react.inc.js, even though I don’t use any optimizations? Something to do with require paths, but can’t make it look in the directory where compiled files are (out)MODULE 33851: load “/Users/a/Sites/boards-io/target/test/test.js" for module "."
MODULE 33851: Module._load REQUEST react parent: .
MODULE 33851: looking for "react" in [”/Users/a/Sites/boards-io/target/test/node_modules”,"/Users/a/Sites/boards-io/target/node_modules","/Users/a/Sites/boards-io/
node_modules”,”/Users/a/Sites/node_modules","/Users/a/node_modules","/Users/node_modules","/usr/lib/node_modules","/usr/lib/node_modules","./","/Users/a/Sites/boar
ds-io/target/test/out/”,”/Users/a/.node_modules”,"/Users/a/.node_libraries","/Users/a/.nvm/versions/node/v6.3.1/lib/node"]
module.js:442
throw err;
^
Error: Cannot find module 'react'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at COMPILED (/Users/a/Sites/boards-io/target/test/test.js:41:87)
at Object.<anonymous> (/Users/a/Sites/boards-io/target/test/test.js:41:310)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
what is the easiest way to start a cljs repl in node from leiningen, with or without a project
@gfredericks how do you specify ClojureScript dep w/o a project?
@gfredericks re: cljs.test - some things were done simply to work around the fact that hardly anything can be done at runtime and must be done at macro time.
@alex-glv need more information, what did you write that triggers that Node.js require?
new to clojurescript/react SPA development - can you plz point me to complete routing example, preferrably bidi or silk?
I see how to match a route, but I don't see library helpers to hook up into browser navigation during page load
you could replace the secretary/dispatch!
with a bidi/match-route
or whatever
it’s a very tiny bit of code, thanks to google closure
in your root component’s did-mount, you’d call whatever processes your route with your routing with js/window.location
. there must be a full example somewhere in the clojureverse
am I correct that all routing libraries do these things: 1. hook into history API 2. parse current window location and call a callback 3. have a sugar function that navigates you to different location and calls a callback
Trying to pick a library for react in clojurescript. So far rum
seems like the nicest because it has server side rendering in clojure. Can't really seem to figure out why reagent does not have this or why rum is rarely mentioned in talks/articles (almost all are about reagent & om).
@dnolen the magical tool I had in mind would pick a cljs version for me. I just wanted to get a cljs repl fast to try something out. I ended up doing "lein new reagent" and "lein figwheel" because I knew that would work, but it was four steps instead of one
@gfredericks not aware of anything
Probably
@dnolen What react wrapper would you recommend for a clojurescript (the project needs to have server side rendering in clojure) ?
Reagent & Om have the most users & documentation. Rum is newer but it has a community and may have the features you want
Yes, still a bit new. to clojure So far the most appealing would be reagent + re-frame but they don't seem to offer clojure rendering.
Seems to be down to rum or om.next. A bit confused with om & om.next when googling for resources. Is om.next stable enough now ?
@claudiu there’s a #reagent channel, maybe ask there first about server side rendering
How do I force a file to be recompiled when annotating it with ^:figwheel-always
, I need macroexpansion to happen anew. I'm fine with a hack
fwiw, @claudiu, rum
is very simple to get started with, and it stays quite simple even as codebases grow. here’s a pretty concise example using rum and datascript: https://github.com/robert-stuttaford/stuttaford.me/blob/master/src/stuttaford/client/components/codex.cljs — you can see it in action here http://www.stuttaford.me/codex
(full disclosure: i work with the person who made rum)
@robert-stuttaford thank you will look into it 🙂
@claudiu people use om.next in production, and it’s pretty stable. that said I would say it’s one of the more challenging bindings to adopt because it has opinions about server/client relationship
so if you’re just getting started with ClojureScript expect some significant rampup time
my recommendation would be to start with something less sophisticated, om.next isn’t going anywhere if you decide you like it at some future time
@robert-stuttaford interesting! I always wondered where does datascript fit into the ecosystem, is it the sql to talk to clojure (server)?
it is integrated with reagent for instance: https://github.com/mpdairy/posh
@schmee if it's not too much can I extend my question about datascript because I'm confused how it fits with data persistence, because I keep on seeing people using both datascript and a database e.g. rethinkdb, are these for optimization purposes or the latter is a necessity?
out of the box Datascript is not involved in persistence whatsoever, it is in-memory only
but I suppose it is possible to extend to that is more of a “cache” for a Rethink-backend, so that the Datascript db mirrors the Rethink one and vice versa
hi all, I’m trying to figure out the cljs equivlent for $(window).unload(cb)
, I’ve tried (.unload (jquery “window”)
and a few other variations but can’t seem to get it right
the method has been removed in jQuery 3.0: https://api.jquery.com/unload/
this doesn’t throw an error (-> (js/$ window) (.on "unload" (fn [e] (js/console.log e))))
Forgive me if this has been asked a bunch 😞, but google turns up little: What is the best way to deploy a library to clojars that supports both node and the browser? In my case, my library would support HTMLCanvasElement
for the drawing in the browser, and node-canvas
when being used from node. https://github.com/Automattic/node-canvas
@scaturr yeah probably (def *canvas* (try (nodejs/require "canvas") (catch :default e (make-html-canvas))))
or something
How can i use https://github.com/apollostack/graphql-tag or something similar to parse a graphql query in cljs?
@dnolen: I created the issue in cljsjs/packages as I am not sure what's causing it. https://github.com/cljsjs/packages/issues/923 it has minimum reproduction repo.
@alex-glv I haven't been following your issue but I don't see you ever requiring cljsjs.react
in that repo
ReactDOM
needs React
and you're never including it
@leov https://pupeno.com/2015/08/18/no-hashes-bidirectional-routing-in-re-frame-with-silk-and-pushy/
@anmonteiro https://github.com/cljsjs/packages/issues/923 I’ve clarified the issue that requiring react doesn’t make a difference. With that reasoning, wouldn’t requiring react.dom resolve react as a dependency anyway? The same way when I require om.dom it requires react.dom which requires react? If I understand your point correctly.
@alex-glv right then I've had your issue and solved it by npm install react
I'm not sure this is a problem with ClojureScript or CLJSJS packaging, but instead with the way React packages are put together
I though I pushed it, but here it is https://github.com/alex-glv/nodejs-cljs/blob/master/src/nodejs-cljs/core.cljs . Installing react from npm seems to fix it. Huh.
@pupeno ping. I just updated to the latest version of free-form and it no longer seems to be dispatching my update event, no errors in the console, not sure where to look. any advice?