This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I have made a ClojureScript tutorial based on the official AngularJS tutorial: https://github.com/vvvvalvalval/reagent-phonecat-tutorial/wiki. Feedback welcome
anybody got any pointers on how this has changed going from 0.0-2760 to 1.7.48?
TypeError: 'undefined' is not an object (evaluating 'goog.dependencies_.pathToNames[path]')
this is just js btw, not cljs->js ... so I just need to work out the correct stuff.
@underplank: we periodically update Google Closure Library, they occasionally change things. goog.dependencies_
is a private implementation detail. If something is relying on it, then that thing should be OK w/ the possibility of breakage.
@underplank: you'll probably want something like this:
var pathToName = {};
for (var key in goog.dependencies_.nameToPath) {
var value = goog.dependencies_.nameToPath[key];
pathToName[value] = key;
}
for (var key in goog.dependencies_.requires) {
if (goog.dependencies_.requires.hasOwnProperty(key)) {
if (goog.dependencies_.requires[key]["cljs.core"]) {
//as key is a path find its namespace
goog.require(pathToName[key]); // will trigger CLOSURE_IMPORT_SCRIPT calls which injectJs into page
}
}
}
BUT obviously, as dnolen said, this is dependent on the current implementation and may not work with the next upgrade.
There's been various twists to the tale: http://dev.clojure.org/jira/browse/CLJS-995
@underplank: I don't think pathToNames exists
I've spent a number of hours now trying to get a basic datascript example working. Can anyone see what I'm going wrong? I start lein figwheel
, refresh my browser and run this:
cljs.user=> (require '[datascript :as d])
cljs.user=> (d/create-conn {})
#<TypeError: Cannot read property 'call' of undefined>
The project is so simple that I'm sure I must be making a silly mistake. Here's the repo: https://github.com/bmaddy/prochaine
Has anyone else run into this error?thanks @bhauman @mikethompson and @dnolen !
Using @mikethompson 's code I think I got it to work. I understand this could change at any time. But as a POC its working for now.
Oh! Thanks @phil_r! I need to run right now, but I'll try that as soon as I get back. Thanks for taking a look!
Im trying to get testing working with reagent and phantomjs with optimization :none.
@bmaddy you should also remove the clojure exclusion, I think that might actually be what did it
I've almost got it but im getting tripped up at `ERROR: Error: goog.require could not find: cljsjs.react STACK TRACE: -> resources/public/cljs/fast-test/goog/base.js: 662 -> resources/public/cljs/fast-test/goog/../reagent/core.js: 8`
ERROR: Error: goog.require could not find: cljsjs.react
STACK TRACE:
-> resources/public/cljs/fast-test/goog/base.js: 662
-> resources/public/cljs/fast-test/goog/../reagent/core.js: 8
this is my compiler map
{:id "fast-test"
:source-paths ["src/cljs" "src/cljc" "env/dev/cljs" "test/cljs"]
:notify-command ["phantomjs"
"test-js/runner-none.js"
"resources/public/cljs/fast-test"
"resources/public/cljs/fast-test/opplz-test.js"
"test/vendor/es5-shim.js"
"test/vendor/es5-sham.js"
"test/vendor/console-polyfill.js"
"window.literal_js_was_evaluated=true"]
:compiler {:pretty-print true
:output-to "resources/public/cljs/fast-test/opplz-test.js"
:source-map "resources/public/cljs/fast-test/opplz-test.js.map"
:output-dir "resources/public/cljs/fast-test"
:optimizations :none
:foreign-libs [{:provides ["cljsjs.react"]
;; Unminified React necessary for TestUtils addon.
:file "resources/components/react/react-with-addons.js"
:file-min "resources/components/react/react-with-addons.js"}]
:source-map-timestamp true}}
Its lifted from the ci.circle one. but im not sure what the foreign-libs does or if I actually need it?
underplank: do you need testutils?
thats a good question I dont know what it does
Probably good to try just using the cljsjs/react jar and commenting out that foreign libs bit
yeah I just found the cljsjs/react deps to put in lein. so Im gonna try adding that in and see what happens.
do you know what testutils does?
ahh ok. I dont think i use them at the moment...
so I added [cljsjs/react "0.13.3-0"] into my :dependencies and still getting the same error.
goog.require could not find: cljsjs.react
Does anyone have any recommendations for good resources around Cljs deployment? Figwheel is awesome in a development environment but I’m having trouble understanding how to get everything to work nicely when I’m not using Figwheel.
When I try just running the Chestnut basic Uberjar steps I stop seeing the Hello Chestnut
message
@venantius: hmm.. for a production deploy you are probably better serving them as static files through nginx or a CDN honestly. Once you have used an optimization level of anything but :none you should just have one file you can upload.
also this might help? http://stackoverflow.com/questions/7816465/serving-static-files-with-ring-compojure-from-a-war
I think if you want the ring server to serve them you have to put a route/resources route in your app. Again this probably isnt the most run-time efficient way of doing it, but from a deployment ease its not all bad.
what’s the best solution around right now for running cljs.test in something like slimerjs on CI? Is there a solid runner/shim solution?
I'm aware of this - https://github.com/boot-cljs-test/testem-runner - but can't vouch for how good it is in practice
does everyone create those impl
dirs just to avoid name clashes between modules and vars in cljs? haha
@tel I don’t think so, you see that pattern in Clojure which doesn’t have that issue. I think it's a simple way to communicate implementation namespaces.
fair enough! I’d wondered about it for a while and just implemented it in order to avoid such a name clash
Anyone here use vim with cljs? I got tired of fireplace not working out of the box with figwheel, and kind of stumbled upon sending text from a buffer directly to the repl via tmux and with this plugin: https://github.com/ervandew/screen
It’s actually really nice, since fireplace’s evaluated results go into vim’s command line instead of the repl.
@wildermuthn: the great thing about that setup is the reliability