Closed lvh closed 9 years ago
Odd... how are you running this? Platform, cljs version, etc.?
I get:
cljs.user=> (require 'cljs-time.core)
nil
cljs.user=> (require 'cljs-time.coerce)
nil
cljs.user=> (require 'cljs-time.format)
nil
cljs.user=> (map some? [cljs-time.core cljs-time.format cljs-time.coerce])
(true true true)
OS X, rlwrap lein figwheel
, this project.clj
:
(defproject crunch "0.1.0-SNAPSHOT"
:description "A workout for your CORE"
:url "https://github.com/rackerlabs/crunch"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/clojurescript "1.7.28" :scope "provided"]
[org.clojure/core.match "0.3.0-alpha4"]
[cljsjs/react "0.13.3-1"]
[reagent "0.5.0"]
[reagent-forms "0.5.5"]
[reagent-utils "0.1.5"]
[com.andrewmcveigh/cljs-time "0.3.10"]
[wilson "0.9.0"]
[com.taoensso/timbre "4.0.2"]
[hickory "0.5.4"]]
:source-paths ["test" "src"]
:target-path "target/%s"
:clean-targets [:target-path "out" "resources/public/cljs"]
:cljsbuild {:builds {:app {:source-paths ["src" "test"]
:figwheel true
:compiler
{:main "crunch.core"
:asset-path "cljs/out"
:output-to "resources/public/cljs/main.js"
:output-dir "resources/public/cljs/out"}}
:test {:source-paths ["src" "test"]
:main "crunch.runner"
:compiler {:output-to "target/test.js"
:optimizations :whitespace
:pretty-print true}}}}
:profiles
{:dev-common
;; (use 'figwheel-sidecar.repl-api) (figwheel-sidecar.repl-api/cljs-repl)
{:dependencies [[leiningen-core "2.5.1"]
;; Client side building
[figwheel "0.3.7"]
[cljsbuild "1.0.6"]
[org.clojure/tools.nrepl "0.2.10"]
;; Client side testing
[doo "0.1.4-SNAPSHOT"]
[org.clojure/core.async "0.1.346.0-17112a-alpha"]
[prismatic/dommy "1.1.0"]]
:plugins [[lein-figwheel "0.3.7"]
[lein-cljsbuild "1.0.6"]
[lein-doo "0.1.4-SNAPSHOT"]
[lein-cljfmt "0.2.1"]]
:figwheel {:css-dirs ["resources/public/css"]
:nrepl-port 7002}
:env {:dev true}}
:dev-overrides {};; Set this in profiles.clj
:dev [:dev-common :dev-overrides]})
I'll keep experimenting.
Even weirder! Under clojurescript
1.7.48:
cljs.user=> cljs-time.core
#js {}
So, not nil, but an empty Javascript object. All other ns'es behave as normal, including foo.core
from other projects.
I've seen figwheel do something funky like that... I'll look into it this evening.
Data confirms, rlwrap lein trampoline cljsbuild repl-rhino
:
cljs.user=> (require 'cljs-time.core)
nil
cljs.user=> cljs-time.core/now
#object[cljs_time$core$now "
function cljs_time$core$now() {
var G__6540 = (new goog.date.UtcDateTime());
G__6540.setTime(cljs_time.core._STAR_ms_fn_STAR_.call(null));
return G__6540;
}
"]
Have you tried to run lein clean
?
On Aug 11, 2015 12:49 PM, "lvh" notifications@github.com wrote:
Data confirms, rlwrap lein trampoline cljsbuild repl-rhino:
cljs.user=> (require 'cljs-time.core) nil cljs.user=> cljs-time.core/now
object[cljs_time$core$now "
function cljs_time$core$now() { var G6540 = (new goog.date.UtcDateTime()); G6540.setTime(cljs_time.core._STAR_ms_fnSTAR.call(null)); return G__6540; } "]
— Reply to this email directly or view it on GitHub https://github.com/andrewmcveigh/cljs-time/issues/41#issuecomment-129964618 .
OK, so the problem is a dependency resolution issue in Figwheel. FWIW, I was abusing it a little: there was no dependency path from my core ns to the ns that requires cljs-time, which seems to trigger the issue.
I've filed upstream: https://github.com/bhauman/lein-figwheel/issues/210.
For future reference, the resolution/workaround is:
I resolved the issue by adding libspecs in my ns forms such that cljs-time.core is depended upon through a ns that Fighweel can find when tracking dependencies starting from the main ns. The cljs-time.core libspec wasn't in my core ns, but requiring the ns that does require cljs-time.core from the core ns allowed Figwheel's dependency resolution system to find the dependency, resolving the issue.
I'm closing this since it appears to be a figwheel dependency resolution bug, not a cljs-time bug.
I have no idea what's going on here. Using
[com.andrewmcveigh/cljs-time "0.3.11"]
. FWIW, theformat
ns isn't just non-nil -- it's fully functional.