<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged configuration</title>
<link>https://ask.clojure.org/index.php/tag/configuration</link>
<description></description>
<item>
<title>reagent undefined in clj-cljs setup</title>
<link>https://ask.clojure.org/index.php/9311/reagent-undefined-in-clj-cljs-setup</link>
<description>&lt;p&gt;I have a project setup where I want to serve my clojurescript from my clojure server and I want to keep all in one repo, if possible. The server works and returns the static resources including reagent files. However, when the &lt;code&gt;app.js&lt;/code&gt; is processed, I get the following console ouput:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;core.cljs?rel=1589815066414:6  undefined
core.cljs?rel=1589815066414:8  Uncaught TypeError: Cannot read property 'call' of undefined
    at core.cljs?rel=1589815066414:8
(anonymous) @ core.cljs?rel=1589815066414:8
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;To my eyes everything in my code looks the way it should be.&lt;/p&gt;
&lt;p&gt;This is my &lt;code&gt;core.cljs&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns ws-poc.core
  (:require
   [reagent.core :as reagent]))
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;(.log js/console reagent) ;; &amp;lt;== reagent is undefined, see first line of log

(reagent/render-component
 [:h1 Works!]
 (. js/document (getElementById &quot;app&quot;)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is my &lt;code&gt;index.html&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset=&quot;UTF-8&quot;&amp;gt;
    &amp;lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&amp;gt;
    &amp;lt;!-- &amp;lt;link href=&quot;css/style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&amp;gt; --&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;div id=&quot;app&quot;&amp;gt;
      &amp;lt;h2&amp;gt;Works!&amp;lt;/h2&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;script src=&quot;js/compiled/app.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is my project structure:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.
├── project.clj
├── resources
│   └── public
│       ├── css
│       ├── index.html
│       └── js
│           └── compiled
│               ├── app.js
│               └── out
│                   ├── cljs
│                   ├── cljs_deps.js
│                   ├── cljsc_opts.edn
│                   ├── cljsjs
│                   ├── clojure
│                   ├── figwheel
│                   ├── goog
│                   ├── process
│                   ├── reagent
│                   └── ws_poc
├── src
    └── ws_poc
        ├── core.cljs
        └── server
           └── core.clj
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And finally my &lt;code&gt;project.clj&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defproject ws-poc &quot;0.1.0-SNAPSHOT&quot;
      :description &quot;FIXME: write description&quot;
      :url &quot;http://example.com/FIXME&quot;
      :license {:name &quot;Eclipse Public License&quot;
                :url &quot;http://www.eclipse.org/legal/epl-v10.html&quot;}
      :dependencies [[org.clojure/clojure &quot;1.8.0&quot;]
                     [org.clojure/clojurescript &quot;1.10.764&quot;]
                     [environ &quot;1.2.0&quot;]
                     [reagent &quot;1.0.0-alpha1&quot;]]

      :plugins [[lein-figwheel &quot;0.5.19&quot;]
                [lein-cljsbuild &quot;1.1.8&quot;]
                [lein-environ &quot;1.2.0&quot;]]

      :source-paths [&quot;src&quot;]

      :clean-targets ^{:protect false} [&quot;resources/public/js/compiled&quot; &quot;target&quot;]

      :main ^:skip-aot ws-poc.server.core

      ; :target-path &quot;target/%s&quot;
      :profiles {:dev {:env {:dev? &quot;true&quot;}
                       :cljsbuild {:builds
                                   [{:id &quot;dev&quot;
                                     :source-paths [&quot;src&quot;]
                                     :figwheel {}
                                     :compiler {:main ws-poc.core
                                                :asset-path &quot;js/compiled/out&quot;
                                                :output-to &quot;resources/public/js/compiled/app.js&quot;
                                                :output-dir &quot;resources/public/js/compiled/out&quot;
                                                :source-map-timestamp true}}]}}}

      :figwheel {:css-dirs [&quot;resources/public/css&quot;]})
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/9311/reagent-undefined-in-clj-cljs-setup</guid>
<pubDate>Tue, 19 May 2020 08:46:47 +0000</pubDate>
</item>
</channel>
</rss>