<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged cljs.main</title>
<link>https://ask.clojure.org/index.php/tag/cljs.main</link>
<description></description>
<item>
<title>ClojureScript :preloads doesn't work with just cljs.main --repl</title>
<link>https://ask.clojure.org/index.php/14863/clojurescript-preloads-doesnt-work-with-just-cljs-main-repl</link>
<description>&lt;p&gt;Running cljs.main with just &lt;code&gt;--repl&lt;/code&gt; doesn't preload whatever is on :preloads.&lt;/p&gt;
&lt;p&gt;Given that the quickest way of trying ClojureScript is by running a command like :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version &quot;1.12.134&quot;}}}}' -M -m cljs.main --repl
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it would be great (and I think expected) to be able to run a repl with some dev tooling, like :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version &quot;1.12.134&quot;} binaryage/devtools {:mvn/version &quot;1.0.7&quot;}}}}' -M -m cljs.main -co '{:preloads [devtools.preload]}' --repl
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but it doesn't work.&lt;/p&gt;
&lt;p&gt;It reads the file (it complains if you misspell the preload namespace) but then nothing gets loaded.&lt;/p&gt;
&lt;p&gt;The problem seems to be related to ClojureScript not compiling the preload namespace when you run with just --repl&lt;/p&gt;
&lt;p&gt;If you create a small single file project (like on the start guide) and then do :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version &quot;1.12.134&quot;} binaryage/devtools {:mvn/version &quot;1.0.7&quot;}}}}' -M -m cljs.main -co '{:preloads [devtools.preload]}' --compile hello-world.core --repl
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it works.&lt;br&gt;
After the compile generates the &lt;code&gt;out&lt;/code&gt; folder you can run just with &lt;code&gt;--repl&lt;/code&gt; and the preload will work.&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14863/clojurescript-preloads-doesnt-work-with-just-cljs-main-repl</guid>
<pubDate>Wed, 24 Dec 2025 15:13:56 +0000</pubDate>
</item>
<item>
<title>Proper deps.edn config with -co option of cljs.main</title>
<link>https://ask.clojure.org/index.php/9439/proper-deps-edn-config-with-co-option-of-cljs-main</link>
<description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am trying translate the following cljs.main options with the CLI:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ clj -m cljs.main          \
      -d public/js/compiled \
      -o public/js/main.js  \
      -O advanced           \
      -c hello-world.core
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Into &lt;code&gt;deps.edn&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:deps {org.clojure/clojurescript {:mvn/version &quot;1.10.764&quot;}
        reagent {:mvn/version &quot;1.0.0-alpha2&quot;}}
 :main &quot;hello-world.core&quot;
 :optimizations :advanced
 :output-dir &quot;public/js/compiled&quot;
 :output-to &quot;public/js/main.js&quot;}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then execute it with:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clj -m cljs.main -co deps.edn
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;However, it doesn't seem to work.&lt;/p&gt;
&lt;p&gt;I also get the following error using the generated &lt;code&gt;main.js&lt;/code&gt; file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;main.js:314 Uncaught TypeError: Cannot read property 'mg' of undefined
    at Mb (main.js:314)
    at Tn (main.js:699)
    at Rn (main.js:698)
    at Nn.h.Me (main.js:718)
    at Function.Wn.A (main.js:710)
    at Nn.h.Le (main.js:718)
    at Function.Wn.j (main.js:710)
    at ep (main.js:761)
    at main.js:761
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Some thoughts&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Am I missing a CLI option? or &lt;code&gt;deps.edn&lt;/code&gt; key/value pair?&lt;/li&gt;
&lt;li&gt;Am I using it wrong; the CLI or &lt;code&gt;deps.edn&lt;/code&gt; or both?&lt;/li&gt;
&lt;li&gt;Or is it not well supported at the moment so I should just stick with the CLI?&lt;/li&gt;
&lt;/ul&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9439/proper-deps-edn-config-with-co-option-of-cljs-main</guid>
<pubDate>Thu, 09 Jul 2020 15:55:05 +0000</pubDate>
</item>
</channel>
</rss>