This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-13
Channels
- # beginners (71)
- # boot (61)
- # clara (49)
- # cljs-dev (9)
- # cljsjs (2)
- # cljsrn (5)
- # clojure (55)
- # clojure-android (1)
- # clojure-italy (4)
- # clojure-spec (39)
- # clojure-uk (56)
- # clojurescript (69)
- # cursive (5)
- # data-science (1)
- # defnpodcast (6)
- # devcards (1)
- # duct (12)
- # figwheel (3)
- # fulcro (18)
- # leiningen (35)
- # lumo (19)
- # midje (1)
- # off-topic (22)
- # om (3)
- # onyx (23)
- # portkey (3)
- # re-frame (20)
- # reagent (23)
- # ring-swagger (6)
- # shadow-cljs (119)
- # specter (7)
- # unrepl (25)
Hi, after changed my code, I found that
have responsed
java.lang.IllegalArgumentException: No matching clause: :get
at $files_req.invokeStatic(ws.clj:197)
at $files_req.invoke(ws.clj:179)
at $process.invokeStatic(ws.clj:283)
at $process.invoke(ws.clj:254)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invokeStatic(core.clj:659)
at clojure.core$apply.invoke(core.clj:652)
at shadow.http.router$call_handler.invokeStatic(router.clj:12)
at shadow.http.router$call_handler.invoke(router.clj:11)
at shadow.cljs.devtools.server.web$root.invokeStatic(web.clj:20)
at shadow.cljs.devtools.server.web$root.invoke(web.clj:19)
at shadow.cljs.devtools.server$get_ring_handler$G__26813__26814.invoke(server.clj:52)
at ring.middleware.params$wrap_params$fn__14985.invoke(params.clj:67)
at aleph.http.server$handle_request$fn__13182$f__649__auto____13183.invoke(server.clj:157)
at clojure.lang.AFn.run(AFn.java:22)
at io.aleph.dirigiste.Executor$Worker$1.run(Executor.java:62)
at manifold.executor$thread_factory$reify__541$f__542.invoke(executor.clj:44)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:745)
And the page was not modified with the newest code, though the console have some correct messages.
@oliver.mooney I didn’t touch the create-react-app
example in quite a while. I imagine a lot has changed since then.
@cmal the client side for the code reload will send a http POST
request to request the new content
somehow that gets turned into a GET
request? do you have a proxy or so that rewrites the request?
I changed the source code of shadow-cljs and set the (env/ws-url js/document.location.hostname :browser)
to (env/ws-url "localhost" :browser)
. This enables the hot reload. but got some error in the requests.
right. so I should allow configuration of the host that is used for the websocket and file updates and it should work?
I changed the param to ws-url, but https://clojurians.slack.com/archives/C6N245JGG/p1510545280000082 happens.
yeah that error is from the server handling the request. it does not expect a GET
request and fails. don’t know how a GET request ends up there.
but it seems to be loading the JS? how else would it produce those re-frame warnings?
But any possibility that the ws sent the data and devtools load the js
s but the page is not reloaded?
DEVTOOLS: load JS doumi/bottomnav_comp.cljs shadow.cljs.devtools.client.browser.js:46
DEVTOOLS: load JS doumi/ua.cljs shadow.cljs.devtools.client.browser.js:46
DEVTOOLS: load JS doumi/core.cljs shadow.cljs.devtools.client.browser.js:46
try putting a (js/console.log "foo")
at the top-level in the file. it should reload yes.
maybe you have some code that is not reloadable properly? eg. a fn
you put into a map somewhere?
there was a bug that the :after-load
fn was not loaded properly and was using the old version (from before the code load)
Yes, the top level code get reloaded. There must be some problems with my code. Thank you @thheller.
@thheller thanks, I thought as much - the regex you talk about in the create-react-app example is out of date. I'm trying to reproduce the fix in the issue you raised here: https://github.com/facebookincubator/create-react-app/issues/2281
Is there a way to set the output directory of shadow-cljs, or is that the normal cljsbuild config option?
the create-react-app
example I made is currently broken because of the relative require it had
I need to add support for that again, works fine if you don’t need relative requires in CLJS though.
I've to restart yarn start
after each cljs change and thought that was the culprit, but I'm not using relative requires, hmmm
there seems to be a bug with watch
. it does not recover when a compile failed with an error.
looking at that next. see https://github.com/thheller/shadow-cljs/issues/105
yeah, I've seen that too, but it's pretty quick to restart - yarn
is the slowpoke for me
the watch
problems should go away with [email protected]
Hi there! I added this dependency "rmwc": "0.0.1-beta10"
to my package.json and I’m getting a funny error message:
ReferenceError: Unknown plugin “react-hot-loader/babel” specified in “/Users/pedro/Developer/rmwc-cljs/node_modules/rmwc/package.json” at 0, attempted to resolve relative to “/Users/pedro/Developer/rmwc-cljs/node_modules/rmwc”
Any thoughts?
The whole package.json
is:
{
"dependencies": {
"create-react-class": "^15.6.2",
"react": "^16.1.0",
"react-dom": "^16.1.0",
"rmwc": "0.0.1-beta10"
},
"devDependencies": {
"shadow-cljs": "^2.0.74"
}
}
you can edit the node_modules/rmwc/package.json
and just rename the babel
entry to xbabel
or so
projects usually remove the babel entry when publishing to npm
, this one doesn’t it seems
really??
big thank you @thheller!
@pedrorgirardi should be fixed in [email protected]
Giving it a try right now 🙂
It did work! 😉
Everything working, so good! Thank you again @thheller!
@thheller is there a way to set :closure-defines
dynamically from the cli? eg. if i want to build a release of a build where the closure variable server-env
is set to dev
or staging
or whatever
it’s a server that will build the cljs :release itself, so the app itself is not running on node and has no access to js/process.env
hm. which kind of caching? it would eg/ read an “API_URL” to know which backend to send ajax requests to, localhost:PORT or test-server.x or prod-server.y
do you have a suggestions on how the env thing could look? I can’t think of a good way to do this right now
https://github.com/shadow-cljs/quickstart-browser/blob/master/src/starter/browser.cljs
if I have any runtime configuration that may change due the which user is accessing it
ah i see. so this is a case where index.html
is generated by a server vs. static file
(ns demo.run-test
(:require [shadow.cljs.devtools.config :as config]
[shadow.cljs.devtools.api :as api]))
(defn build [& args]
(let [config
(-> (config/get-build! :your-build)
(assoc-in [:compiler-options :closure-defines 'some.ns/define] (System/getenv "FOO")))]
(api/release* config {})
))
[email protected]
pushed like 5min ago
I should add a get-build-config
fn to the api
namespace but besides that it should work
shadow-cljs clj-run demo.run-test/fn1 1 2 3
shadow-cljs - config: /Users/zilence/code/shadow-cljs/shadow-cljs.edn version: 2.0.76
shadow-cljs - connected to server
[:fn1 ("1" "2" "3")]
ah correct. that is a bit confusing because it still shows 2.0.76 even though it’s not actually running that version