Skip to content

Instantly share code, notes, and snippets.

@swannodette

swannodette/project.clj

Forked from hsestupin/project.clj
Last active Dec 15, 2015
Embed
What would you like to do?
(defproject cljs-gwt "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.5.1"]
[org.clojure/clojurescript "0.0-2138"]
[compojure "1.0.4"]
[hiccup "1.0.0"]]
:plugins [[lein-cljsbuild "1.0.1"]
[lein-ring "0.7.0"]]
:ring {:handler cljs-gwt.core/app}
:source-paths ["src/clj"]
:cljsbuild {
:builds [{:id "dev"
:source-paths ["src/cljs"]
:compiler {
:output-dir "resources/public/js/out/"
:output-to "resources/public/js/cljs_gwt.js"
:source-map true
:optimizations :none}}
{:id "prod"
:source-paths ["src/cljs"]
:compiler {
:output-to "resources/public/js/cljs_gwt.js"
:optimizations :advanced}}]})
@hsestupin

This comment has been minimized.

Copy link

@hsestupin hsestupin commented Feb 2, 2014

It's not working also with the same browser error "Uncaught ReferenceError: goog is not defined".
It raises because lein-cljsbuild generates the following file structure:

resources/public/js/goog/ ...
resources/public/js/cljs_gwt/ ...
resources/public/js/cljs/ ...
resources/public/js/cljs_gwt.js

and cljs_gwt.js contains the only following strings:

goog.addDependency("base.js", ['goog'], []);
goog.addDependency("../cljs/core.js", ['cljs.core'], ['goog.string', 'goog.array', 'goog.object', 'goog.string.StringBuffer']);
goog.addDependency("../cljs_gwt/core.js", ['cljs_gwt.core'], ['cljs.core']);

So in fact "goog" object is really undefined within such generated file structure. Hope my explanation is clear.

@swannodette

This comment has been minimized.

Copy link
Owner Author

@swannodette swannodette commented Feb 2, 2014

@hsestupin, I've tweaked :output-dir. Also worth taking a look at https://github.com/magomimmo/cljs-start, I'm pretty sure they've solved the configuration problem.

@hsestupin

This comment has been minimized.

Copy link

@hsestupin hsestupin commented Feb 2, 2014

And of course before trying your option I made "lein cljsbuild clean"

@swannodette

This comment has been minimized.

Copy link
Owner Author

@swannodette swannodette commented Feb 2, 2014

@hsestupin, actually you don't need to set :source-map-path since source maps are produced for every single file.

@hsestupin

This comment has been minimized.

Copy link

@hsestupin hsestupin commented Feb 2, 2014

; The optimization level. May be :whitespace, :simple, or :advanced.
; Defaults to :whitespace.
:optimizations :whitespace

It's from "lein cljsbuild sample". And there is nothing said about :none option. Don't know why, but {:optimization :whitespace} generates working file-structure and sorce maps works well with that

@twashing

This comment has been minimized.

Copy link

@twashing twashing commented Dec 15, 2015

I'm finding the same thing happening to me. :optimizations :whitespace generates the correct file and file structure. But :optimizations :none was giving me this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment