hey folks, how are you running your shadow-cljs project tests locally? are you using command line or the repl or maybe both?
I use the command-line. Sometimes, I specify a .dir-locals.el variable to run them when I cider-jack-in
i was looking for a solution to run test in clojurescript like we do with cider-test-run-test
fn in clojure. however, when i tried it i got this user-error: Clojure-only operation requested in a ClojureScript buffer
so i was wondering how folks with more experience in clojurescript nowadays are running their tests
thanks for sharing @cattabanks 🙂
Hey all. I'm looking at clojurescript for a project target Duktape, an embedded, es5 compliant javascript engine
is it possible to get the clojurescript compiler to output a single file, ready to roll with all dependencies bundled?
(when I try to target node, the output file tries to require
a bunch of stuff. When I try to target browser, the output file tries to fetch a bunch of stuff)
It seems there is no clear policy as which optimizations bundle everything in a single file - I would have thought both :simple and :advanced, but only :advanced seems to do that. Is there an established answer? http://Clojurescript.org and Goog.closure sites don’t mention it. I am trying for a single-file bundle with :simple - is this possible? Thx
Also, it seems dependencies in :none optimization are fetched relative to :output-dir. Is this correct? Thx..
I am reading a tutorial here https://github.com/Rovanion/webgl-clojurescript-tutorial/blame/master/README.md#L237 and there is this line (catch js/Error e (recur (next ids))))))]
that throws when I try to compile it with Can't recur here
I am not sure what is happening, is this code that was working before but not anymore? Or what could be the problem?
Is there a compiler setting which writes the goog
initialization and deps within a <script>
tag, instead of in-line (`document.write(…`)?
Are you creating a dev build? Because a release build should produce a single file with everything bundled together.
At least, for browsers. No idea about node.
How would your compiler change your HTML? Or maybe I misunderstand the question.
I've tried browser, webworker, and node
with whitespace, simple, and advanced optimizations
so far, no dice
What is shadow-cljs? They seem to support targeting react-native: https://shadow-cljs.github.io/docs/UsersGuide.html#target-react-native
Interesting. It's not allowed in Clojure either. I don't know for sure but I think you're right about this working on some older CLJS.
Either way, the fix it rather trivial - just wrap try-catch in a let
and recur from the let's body.
(which means running in JavaScriptCore, which is an embedded engine)
I use shadow-cljs for browser. When I run production build, only a single file is produced.
Also from the documentation: "The :target :node-script produces single-file stand-alone output that can be run using node.js"
Right, but there's something about the compiled output that fails inside duktape 😕
Have you tried setting :output-feature-set
to :es5
?
Although I think that's the default...
ah, how do I do that?
(all I have is a deps.edn file)
Thanks @p-himik ..You understood correctly - maybe there is a way to output the fragment to a file? Or to disable it? Way back there used to be an introductory cljs tutorial where this was done manually..
(and a hello-world file)
If you're using shadow-cljs, you should also have a shadow-cljs.edn
file.
https://shadow-cljs.github.io/docs/UsersGuide.html#_output_language_options
The only thing that I've seen where something was done manually is the addition of a single <script src="...">
line that makes the browser fetch the main JS bundle and maybe another <script>
line that executes the entry function.
In any case - what is the problem that you're trying to solve?
I am writing a browser extension, and would have to muck with security policy (CSP) to make that possible. No inline JS is allowed by default
I'm using shadow-cljs. A release build produces a single file that you can add with <script src="...">
. It doesn't try to load any other files.
is it doable just with the deps.edn
file and the clj CLI?
Ok…will see if I can use that - thanks!
I don't know for sure. You'll have to peruse the documentation or ask in #shadow-cljs
If that doesn't help, you can always ask in #shadow-cljs
Hi all! I've came across a problem with CLJS compilation recently, where my code behaves differently if I compile it with different optimizations options (advanced and simple). I made this small example showing it (https://github.com/felipegmarques/example-cljs-optimizations-affecting-code-behavior). Does anyone have a similar problem?
how do i make it so changes to deps.edn trigger a rebuild?
for example adding a dependency?