This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-19
Channels
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
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)
Are you creating a dev build? Because a release build should produce a single file with everything bundled together.
What is shadow-cljs? They seem to support targeting react-native: https://shadow-cljs.github.io/docs/UsersGuide.html#target-react-native
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"
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
I don't know for sure. You'll have to peruse the documentation or ask in #shadow-cljs
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?
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.
Is there a compiler setting which writes the goog
initialization and deps within a <script>
tag, instead of in-line (`document.write(…`)?
Thanks @U2FRKM4TW ..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..
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.
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?