Hello all,

In my project I want to use Closure modules.
I have defined this in my project.clj:

:modules {:source-paths ["src-cljs" "src-cljs-prod"]
                      :compiler
                      {:optimizations :advanced
                       :modules
                       {:cljs-base
                        {:output-to "resources/public/js-modules/cljs.js"}
                        :input
                        {:output-to
                         "resources/public/js-modules/new-recipe-form.js"
                         :entries #{"recipes.new-recipe-form"}}
                        :hello
                        {:output-to
                         "resources/public/js-modules/hello.js"
                         :entries #{"recipes.main"}}}}}

The namespace recipes.new-recipe-form depends on React and Reagent, so I was 
hoping that Google Closure would move all of React into the module :input.

When I compile with "lein cljsbuild once modules", I first get a 
java.io.FileNotFoundException. This problem is solved by creating the output 
dir manually:

mkdir -p resources/public/js-modules

When compilation finally succeeds, I see three .js files in my output dir:

cljs.js: 368 KB
hello.js 49 bytes
new-recipe-form.js: 5KB

When I look at the source of cljs.js, it starts with the entire React library. 
Unfortunately, because even when I want to run hello.js it needs cljs.js.

The file recipes.main on which the module hello was based only contains this 
code:

(ns recipes.main)
(.log js/console (str "Hello world" (inc 10)))

It's kind of bad that I need to load React before I can execute that code.

If you have some suggestions, please respond.

Kind regards,

Michiel



-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to