This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-06-22
Channels
- # babashka (36)
- # beginners (42)
- # calva (6)
- # chlorine-clover (25)
- # cider (31)
- # clara (5)
- # clj-kondo (55)
- # cljdoc (3)
- # cljs-dev (7)
- # cljsrn (3)
- # clojure (73)
- # clojure-brasil (6)
- # clojure-europe (8)
- # clojure-italy (2)
- # clojure-nl (3)
- # clojure-norway (1)
- # clojure-spec (3)
- # clojure-sweden (4)
- # clojure-switzerland (2)
- # clojure-uk (29)
- # clojurescript (93)
- # conjure (21)
- # data-science (14)
- # datomic (19)
- # emacs (4)
- # exercism (3)
- # figwheel-main (38)
- # fulcro (38)
- # graalvm (42)
- # graphql (5)
- # jackdaw (3)
- # jobs (1)
- # joker (2)
- # lambdaisland (1)
- # leiningen (31)
- # malli (8)
- # meander (5)
- # off-topic (27)
- # pathom (2)
- # pedestal (28)
- # re-frame (25)
- # reagent (2)
- # reitit (11)
- # releases (3)
- # remote-jobs (1)
- # rum (1)
- # shadow-cljs (63)
- # spacemacs (17)
- # sql (1)
Hi, is this a problem with Shadow or with ClojureScript? When I try to compile a file with:
(when something
(nil 10))
It should point to the second line, right? But it is pointing to the first one...This is an example of the error that gets displayed:
------ ERROR -------------------------------------------------------------------
File: /home/mauricio/.atom/packages/chlorine/repl-tooling/src/repl_tooling/repl_client/shadow_ws.cljs:195:1
--------------------------------------------------------------------------------
192 |
193 |
194 |
195 | (when-not true
-------^------------------------------------------------------------------------
Error in phase :compilation
Can't call nil at line 196 repl_tooling/repl_client/shadow_ws.cljs
--------------------------------------------------------------------------------
196 | (nil 10))
197 |
198 | ; (lol/bar 10)
199 | ; (-> msg :build-status :report println)
--------------------------------------------------------------------------------
This points to the right line, for example:
(when something
::wrong-ns/keyword)
(Well, I also found lots of interesting behaviors with compilation errors, so maybe it's not really a problem after all 😄. After all, compilation errors are quite rare anyway 😄)
Excuse the cross-posting but I just added this to #clojurescript but I am currently using Shadow and part of my problem may be able to be solved in Shadow. Any help appreciated https://clojurians.slack.com/archives/C03S1L9DN/p1592802205168100
My tl;dr for the above: Is there a way to output function my_function(...) {...}
for CLJS functions marked with ^:export
(or somehow marked in any other way)?
Specifically this kind of construct is needed. var my_function = ...
and
will not work.
Is there a trick to getting core async go blocks to execute to work when using the :node-test
target?
@pwalsh you can specify a name for :export
(defn foobar
{:export "someName"}
[]
(js/console.log "called me!"))
thanks @U05224H0W - unfortunately it does not work. It looks like it does expose someName
in the global scope, but, it still compiles foobar
to function c() {}
(i.e; the function definition, which apps script needs, is not the original name of the function).
so you are saying that var onOpen = function() { ... };
would be invalid in apps-script?
https://developers.google.com/apps-script/guides/v8-runtime#improved_function_detection I guess thats the issue then. looks like it tries to analyze the code instead of just calling it?
> so you are saying that `var onOpen = function() { ... };` would be invalid in apps-script? Yes, exactly
btw I solved this not even with externs. I just compile my clojurescript, and also push a javascript file to app script which exposes the public interface for app script and calls the functions from the compiled clojurescript.
(for anyone who every does this in future, use https://github.com/google/clasp so you can work with your code using a normal workflow and push to apps script like "deploying" your code - it is very useful)
you could use (js* "function onOpen() { your.ns.actual_on_open() };")
but don't tell anyone I said that
nice, thanks @U05224H0W
so judging from the apps script example just (defn on-open {:export "onOpen"} [] ...)
?
@ramblurr there is nothing special regarding :node-test
and async go blocks. they work exactly as they do in all other targets
hi i want to split our project. i read about modules, but as i understand its still same project.
:modules
has nothing to do with how you organize your project. it only splits the output into several files but still requires compiling everything together.
"modules" unfortunately is a bad name with very different meaning in many different contexts
:modules
is about the produced output. so thats what you do to get "dynamically loaded modules" from
the input however does not matter for this. so whether this is coming from multiple libraries or not doesn't matter
https://code.thheller.com/blog/shadow-cljs/2019/03/03/code-splitting-clojurescript.html
if you are asking how to use multiple independent projects and their produced .js
files together on one page then that is not supported
I’ve just tried putting {:deps-aliases [:cider]}
in my .shadow-cljs/config.edn
file and I now get the error nREPL middleware: shadow.cljs.devtools.cli has no namespace error Command failed with exit code 2.
when running shadow-cljs watch myapp
, any idea how to resolve this?
weird copying the alias into :dependencies
style works
what I think you want is moving some code into a library that you use as a dependency in your main project
so basicaly i got view components which are used in core project which provides routing between those components
Are there any docs/guides for connecting emacs/cider to a :node-test
target? I can't figure out how to connect to the right repl. It's erroring with no js runtime available.
When I follow the instructions from the guide (https://shadow-cljs.github.io/docs/UsersGuide.html#_launch_the_clojurescript_repl) after the repl connects, I've given a cljs.user>
prompt, but typing anything in it prints No available JS runtime.
I selected my app using the :node-script
target
The shadowjs web ui (http://localhost:9630/runtimes) only shows a single clj
runtime, no cljs
runtimes
Hm ok strange. Rather than choosing my app build target, I just chose node-repl
and then I get a functioning cljs.user>
repl.
Hey all! Is there any way to resolve a javascript require via a symbol at compile time? I've got a library that's an NPM dependency and I'm writing a macro that generates code for it. How can I consume that macro in a different namespace? ie. unlike "normal" shadow requires, I can't use the fully qualified namespace since that'd be a string. Furthermore, the macro is meant to be used inside a function body, so something like (do (require "foo" :as foo) (defn something [] (foo/bar)))
won't work
Never mind, looks like js/module$node_modules$str
@rschmukler are you trying to dynamically require a module?
FWIW require
is only available at dev time; it won’t work when you do a release build even if it’s static AFAIK
It's at compile time. I managed to get it working by looking at what resolve
resolves the symbol to when you do (:require ["library" :as foo])
- turns out it's a string concat of node_modules + other stuff
Thanks though 🙂