This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-11
Channels
- # announcements (4)
- # babashka (4)
- # beginners (164)
- # calva (47)
- # cider (1)
- # cljs-dev (29)
- # cljsrn (3)
- # clojure (137)
- # clojure-europe (23)
- # clojure-nl (3)
- # clojure-spec (7)
- # clojure-uk (44)
- # clojurescript (35)
- # component (8)
- # conjure (119)
- # cursive (32)
- # datomic (12)
- # emacs (31)
- # figwheel-main (36)
- # graalvm (10)
- # jobs (2)
- # kaocha (1)
- # lein-figwheel (3)
- # meander (15)
- # mount (3)
- # off-topic (9)
- # pathom (8)
- # quil (4)
- # re-frame (13)
- # reagent (15)
- # remote-jobs (10)
- # shadow-cljs (128)
- # slack-help (2)
- # spacemacs (8)
- # test-check (6)
- # xtdb (6)
It doesn’t appear to? I’ve been trying to do it for a while, the file loads, but to get edits I have to keep rebooting the repl, which is a bit of a pain =)…
I’m using the js-options
:
:js-options
{:resolve {"terrain" {:target :file
:file "resources/public/js/terrain.js"}
why not use https://shadow-cljs.github.io/docs/UsersGuide.html#classpath-js instead? no :resolve config required for that
Well I keep getting failed to convert sources
… Not sure if there’s something I need to do to get it working?
I’m not sure that reloading work either? I verbatim copied the imported code across to get things working, but it’s still complaining about missing imports… I thought it might not be watching the folder but:
(shadow/watch :test)
=> :already-watching
Well the biggest one is that the javascript code in the path doesn’t appear to reload? I’m not sure if I’m supposed to refresh it in some special way?
:resolve
with :target :file
is not supposed to reload and never will. mostly because it shouldn't be used in the first place
I’ve removed the :resolve in shadow-cljs config, and now have it under my src
and am requiring it with:
["/rm/terrain" :as terrain]
["/rm/language" :as language]
The import works, but making code changes in the js files doesn’t appear to do anything…
It didn’t originally, I’ve basically just exported every function and am resolving the imports….
yeah it doesn't affect anything ... I'm just likely going to remove the "guess-the-extension" part soon
a simple example might be enough. basically I do not know what you mean when you say "exported every function" since there are multiple ways of doing that
Give me a minute =)… I’m putting something together, I’ve been wanting to figure out a way to get more comfortable with cljs/js interop and I’m still super unfamiliar with this stuff
I can add in the changes I made, but that might be counterproductive… The synopsis is that I just added export
before functions that I wanted in language.js
, eg:
export function makeRandomLanguage
export function makeWord
and basically all the functions in terrain.js
.Actually here: https://github.com/Folcon/terrain/compare/master...Folcon:js-code-reloading?expand=1
I’m testing it by:
Adding a console.log in language.js
:
export function makeRandomLanguage() {
console.log("TEST");
var lang = makeBasicLanguage();
lang.noortho = false;
Then calling this in terrain-cljs.core-test
:
(.makeWord language (.makeRandomLanguage language) "city")
That’s been added, the branch https://github.com/Folcon/terrain/tree/js-code-reloading has all the changes with the exports…
well reloading JS is always tricky so it will always be more limited than reloading CLJS
try 2.9.1
, hot-reloading the JS should work fine again assuming they have proper import/export
I just included [goog.string :refer [format]]
at my require namespaces, in dev it worked fine i can use (format)
but it dont find the google lib when i compile a release bundle
@papachan goog.string.format
is a separate namespace from goog.string
so to use it properly you must require it separately
👋 hi everyone! it's been a while since I've been here. I missed you guys! I am updating a library I wrote in cljs a year or so ago. I updated to the latest version of Clojurescript and for some reason now I can't eval functions with docstrings or macros... does anyone have an idea what's going on?
i'm using the latest shadow-cljs
you'll need to clarify what "I can't eval functions with docstrings or macros" means
It seems that I can eval functions if I remove the docstrings from them
I'm using Cursive and I run send (form) to REPL
in general, i'm getting some wierdness... I have been slamming my face against the keyboard for a day
It's been a while, but last time I updated the lib I could send forms to the REPL and they would seem to be read in correctly by printing the function name with a hash in front, like:
#'census.utils.core/update-map
but now the REPL just prints nil
when I include the docstring
I'm like five minutes away from rewritting the thing in js
I can't believe how much of a PITA the tooling is to pick up again (after a year off)
I've tried Cursive, Calva, Chlorine, back to Cursive they all do the same thing
I can look at this issue on Chlorine, but I'm not seeing this problem with any target I'm seeing... Did you try to update shadow-cljs? Or even core.async
I don't know what I'm doing wrong
btw, hi @thheller
long time, no talk
I really don't know what else to tell you... I mean the same code worked last year
$ shadow-cljs browser-repl
shadow-cljs - config: /mnt/c/Users/thheller/code/shadow-cljs/shadow-cljs.edn
shadow-cljs - connected to server
cljs.user=> (defn foo "docstring" [a] a)
#'cljs.user/foo
cljs.user=> (foo 1)
1
let me try that
just simple
λ shadow-cljs node-repl
shadow-cljs - config: C:\Users\logan\Projects\census\census-geojson\shadow-cljs.edn cli version: 2.8.59 node: v10.16.2
shadow-cljs - connected to server
census.utils.core=> (defn foo "docstring" [a] a)
nil
census.utils.core=> (foo 1)
TypeError: Cannot read property 'call' of undefined
at cljsEval (<eval>:1:31)
at global.SHADOW_NODE_EVAL ([stdin]:90:10)
at Object.shadow$cljs$devtools$client$node$node_eval [as node_eval] (C:\Users\logan\Projects\census\census-geojson\.shadow-cljs\builds\node-repl\dev\out\cljs-runtime\shadow\cljs\devtools\client\node.cljs:24:1)
at C:\Users\logan\Projects\census\census-geojson\.shadow-cljs\builds\node-repl\dev\out\cljs-runtime\shadow\cljs\devtools\client\node.cljs:49:13
at Object.ret [as repl_call] (C:\Users\logan\Projects\census\census-geojson\.shadow-cljs\builds\node-repl\dev\out\cljs-runtime\shadow\cljs\devtools\client\env.cljs:104:11)
at Object.shadow$cljs$devtools$client$node$repl_invoke [as repl_invoke] (C:\Users\logan\Projects\census\census-geojson\.shadow-cljs\builds\node-repl\dev\out\cljs-runtime\shadow\cljs\devtools\client\node.cljs:47:1)
at shadow$cljs$devtools$client$node$process_message (C:\Users\logan\Projects\census\census-geojson\.shadow-cljs\builds\node-repl\dev\out\cljs-runtime\shadow\cljs\devtools\client\node.cljs:118:5)
at C:\Users\logan\Projects\census\census-geojson\.shadow-cljs\builds\node-repl\dev\out\cljs-runtime\shadow\cljs\devtools\client\env.cljs:183:9
at Object.shadow$cljs$devtools$client$env$process_next_BANG_ [as process_next_BANG_] (C:\Users\logan\Projects\census\census-geojson\.shadow-cljs\builds\node-repl\dev\out\cljs-runtime\shadow\cljs\devtools\client\env.cljs:171:7)
at Object.shadow$cljs$devtools$client$env$process_ws_msg [as process_ws_msg] (C:\Users\logan\Projects\census\census-geojson\.shadow-cljs\builds\node-repl\dev\out\cljs-runtime\shadow\cljs\devtools\client\env.cljs:184:7)
census.utils.core=>
and without docstring...
> (defn foo [a] a)
#'census.utils.core/foo
> (foo 1)
1
census.utils.core=>
project.clj, but I kinda rely on the pom.xml
file with cursive
just plain shadow-cljs.edn
shadow-cljs.edn
no to :lein true
here's my setup:
{:source-paths ["src"]
:dependencies [[org.clojure/core.async "1.0.567"]
[cljs-ajax "0.8.0"]
[funcool/cuerdas "2.2.0"]
[clojusc/defun "0.4.0"]
[frankiesardo/linked "1.3.0"]
;[jamesmacaulay/cljs-promises "0.1.0"] ; FIXME: When batching cartography files: uncomment and `shadow-cljs pom`
;[cider/cider-nrepl "0.21.0"]
[net.cgrand/xforms "0.19.2"]]
:nrepl {:port 3333}
:builds {:lib {:target :node-library
:output-dir "public/census"
:output-to "public/census/census.js"
:compiler-options {:optimizations :advanced}
:exports-var census.core/census}
:geo {:target :node-library
:output-dir "public/geo"
:output-to "public/geo/batch_convert.js"
:compiler-options {:optimizations :simple}
:exports-var configs.geojson.core/batch_convert}}}
better yet just remove the core.async dependency completely. shadow-cljs depends on core.async so it will always be available
ah, ok
Fuck yes dude!
that did it
btw, I did have to npm i -D ws
was getting an error that that was missing
you should have shadow-cljs installed in the project itself, that will take care of that also
ok, will do
OMG you have no idea how angry I was getting 😄
thank you sir
I'm curious to know what exactly happened since core.async issues usually fail in different ways 😛
you and me both
who knew
your intuition was right though
man, I feel so much better... did you ever set up a way for us to donate to the project?
https://github.com/thheller/shadow-cljs see the sponsors button 😉
:thumbsup: