This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-01
Channels
- # aatree (1)
- # admin-announcements (11)
- # beginners (77)
- # boot (73)
- # braid-chat (29)
- # cbus (3)
- # clara (3)
- # cljs-dev (16)
- # cljsjs (2)
- # cljsrn (68)
- # clojure (149)
- # clojure-austin (1)
- # clojure-czech (2)
- # clojure-miami (8)
- # clojure-poland (28)
- # clojure-russia (165)
- # clojure-ukraine (1)
- # clojurebridge (3)
- # clojurescript (64)
- # community-development (1)
- # core-async (27)
- # core-matrix (2)
- # cursive (38)
- # data-science (2)
- # datavis (4)
- # datomic (3)
- # dirac (78)
- # emacs (10)
- # events (1)
- # funcool (6)
- # hoplon (25)
- # immutant (2)
- # jobs (3)
- # ldnclj (34)
- # luminus (4)
- # mount (23)
- # off-topic (26)
- # om (121)
- # onyx (320)
- # other-lisps (1)
- # proton (13)
- # re-frame (33)
- # yada (3)
is there something that can be done about this warning?
devtools/sanity_hints.js:111: WARNING - dangerous use of this in static method devtools.sanity_hints.type_error_to_string
var self = this;
^
Feb 01, 2016 10:36:24 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
our CI tests grep for warnings in the cljsbuild log so I can't get my build to pass š
not sure if this can be rewritten somehow: https://github.com/binaryage/cljs-devtools/blob/master/src/devtools/sanity_hints.cljs#L94
I think that warning is a relatively recent thing in google closure compiler, this-as could have been written/designed before
actually my code in cljs-devtools is using this-as in prototype method, but it is not obvious to closure compiler
maybe if type-error-to-string
was an anonymous function, it could get the compiler to successfully detect it as a prototype method?
I tried only including devtools as a dependency for my :devtools
lein profile, but the code doesn't compile when I'm not using that profile
(defmacro require-devtools! []
(when (:devtools env)
'(js/goog.require "frontend.devtools")))
@frank: the fix worked: https://github.com/binaryage/cljs-devtools/commit/e5fad13e4565ddeac59ed06cfe551455b47303f2
I have
:profiles {:devtools {:repl-options {:port 8230
:nrepl-middleware [dirac.nrepl.middleware/dirac-repl]
:init (do
(require 'dirac.agent)
(dirac.agent/boot!))}
:env {:devtools true}
:cljsbuild {:builds {:dev {:source-paths ["devtools"]}
:whitespace {:source-paths ["devtools"]}
:test {:source-paths ["devtools"]}
:production {:source-paths ["devtools"]}}}
:dependencies [[binaryage/devtools "0.5.2"]]}}
that being said, Iām not aware of any lein-cljsbuild feature which would allow you to compose builds somehow
I guess I'll do something like ~(zipmap [:dev :whitespace :test :production] (repeat {:source-paths ["devtools"]})
but in this case I would just (def shared-source-paths [ā¦]) and then use :source-paths ~(concat shared-source-paths [ā¦])
I've moved the source file into a different source path but the compiler still seems to be looking for the file š
@darwin: thanks for your comment on http://dev.clojure.org/jira/browse/CLJS-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42130#comment-42130
I got a bit confused by the devtools sample because it includes devtools in the main dependencies. Am I reading it wrong, or is that project going to include devtools in advanced compilation? https://github.com/binaryage/cljs-devtools-sample/blob/master/project.clj#L7
@danielcompton: hmm, adding something into dependencies does not mean it will be included by cljsbuild
for cljs compilation :source-paths of cljsbuild :build configs is the important piece, and cljs-devtools-sample didnāt have any :advanced build until today
and I added it today just to test compilation warnings under :advanced mode, not really use cljs-devtools under :advanced mode
What weāve done is made dev-src/init.cljs
, and src/init.clj
. The dev-src one adds cljs-devtools, the src one doesn't
When we build for dev we add dev-src
to the classpath, in prod we use the src one which is a no-op
classpath is not that important, important it what you put into :source-paths of cljsbuild
btw. alternative solution is to require devtools dynamically, by calling js/goog.require (depending on some condition)
weāve discussed it here with frank, it is pretty flexible to use environ library and include cljs-devtools dynamically based on environmental variable
yeah sorry, classpath was the wrong term to suse
So something like (if js/goog.DEBUG (js/goog.require devtools.core))
yes, but you require your dev-src namespace which does its work to require devtools and calls install!
wait, you want to use macro to generate that js/goog.require snippet only under debug mode
ah, this technique is used in cljs-devtools-sample itself: https://github.com/binaryage/cljs-devtools-sample/blob/master/src/demo/devtools_sample/boot.cljs#L31-L32
weasel is just a simple macro: https://github.com/binaryage/cljs-devtools-sample/blob/master/src/demo/devtools_sample/config.clj#L7-L8
but what frank did above, he has a macro which generates the code (js/goog.require āsomethingā) or nothing, this is the safest way I think
when it is not generated, there is not goog.require for something
anywhere in the code, so something
will be marked as a dead code and eliminated
awesome, thanks!