This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-30
Channels
- # bangalore-clj (1)
- # beginners (104)
- # boot (207)
- # cider (173)
- # cljs-dev (157)
- # cljsjs (1)
- # cljsrn (51)
- # clojure (196)
- # clojure-berlin (1)
- # clojure-chicago (1)
- # clojure-italy (4)
- # clojure-new-zealand (1)
- # clojure-nl (1)
- # clojure-russia (28)
- # clojure-spec (17)
- # clojure-uk (73)
- # clojured (13)
- # clojurescript (110)
- # core-async (4)
- # datascript (25)
- # datomic (92)
- # editors (1)
- # emacs (157)
- # events (4)
- # hoplon (16)
- # klipse (74)
- # lein-figwheel (10)
- # leiningen (2)
- # lumo (13)
- # off-topic (78)
- # om (3)
- # om-next (3)
- # onyx (14)
- # protorepl (1)
- # re-frame (17)
- # reagent (23)
- # remote-jobs (1)
- # ring-swagger (33)
- # schema (2)
- # slack-help (3)
- # spacemacs (7)
- # testing (1)
- # yada (7)
goog.provide(”module$foo”); module$foo$foo = function() {}; var module$foo = module$foo$foo;
@bhauman that is a feature that we probably would like to have in boot-figreload
as well I will peek at your code 😀
(again lol)
heh yeah Google Closure actually has a test for that code gen - I’ll probably ask around whether that’s necessary - it’s not clear to me what semantic it’s preserving by doing things that way
so it seems the output of CommonJS preprocessed by Google Closure really is incompatible with Node.js here
woohoo
just got Circle Color working with NPM deps
+ advanced compilation
surprisingly the problem is with optimizations :none
😄
I don't know how to work around the process.env.NODE_ENV
stuff
@roman01la's trick worked for advanced
@anmonteiro just make a process.env
ClojureScript namespace with (goog-define NODE_ENV “development”)
hrm, maybe I just need to set!
process in window
or something
I did that, but it doesn't get picked up with :none
I suppose it needs to be a global
or I'm just doing something wrong
might be dep order.. hrm
:preload
, maybe?
right, I put it as the last require
let's see if I move it to first place
hrm, no dice
@bhauman I don’t have a good answer for the __filename
, __dirname
problem. If it turns out to be a huge issue I may just wire in special support for that under :target :nodejs
want to hear more feedback first and whether there aren’t other subtler problems with global require for everything first though
@anmonteiro hrm ok
the Circle Color project is 33.8KB gzipped
it doesn't use anything CLJS, I believe
52KB gzipped if I add:
(enable-console-print!)
(println "hi")
which is in line with your results I believe
preloads seems to work for setting process.env
weird thing is I get this now: Uncaught TypeError: this._instantiateReactComponent is not a function
at ReactCompositeComponentWrapper$$module$$Users$anmonteiro$Documents$github$circle_color$node_modules$react_dom$lib$instantiateReactComponent.performInitialMount
etc..
a solution is also to exploit the :preamble
option
to set process.env.NODE_ENV
but then again, only works for :simple
or :advanced
@mrg to be safe you should always stay away from js*
(defn jquery [sel] (js/jQuery sel))
that should make the whole inference more reliable .. but jquery is going to be tough regardless
I guess currently it may warn about adding externs to Object
but you can ignore these if you like
it probably wouldn’t be hard to suppress those warnings in the case of this pattern - a top level tainted value
@dnolen chaining won't work without tags right? $('.thing').css().click().attr().etc()
?
@dnolen with (def jquery js/$)
I am getting the warning WARNING: Cannot infer target type in expression (. (jquery ".slider") slider (clj->js {"full_width" false}))
@dnolen there's a problem in cljs.build.api/add-package-jsons
where it won't find the package.json
for packages which :main
entry is not at the root of the package
i.e. if :main
is lib/Foo.js
, it'll try to look for package.json
in lib
and bail when not found
@anmonteiro yeah, I didn’t know how common that was - so I didn’t bother handling that case
seems common enough for these 4 packages 🙂
@dnolen patch welcome?
still trying to figure that out
just checking one level up seems too naive
that's what I'm looking into now
any reason the module_deps.js
file has to be a single line?
would clojure.string/replace
fail otherwise?
@anmonteiro no reason other than I didn’t test what happens if it isn’t?
I think I have something that works
another benefit is also dropping the JSONStream dep 🙂
Foreign-deps from local deps.cljs
files don't currently work with Boot-cljs because relative-name
presumes that the files are under user.dir
: https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/util.cljc#L152
hrm that's unfortunate
@juhoteperi where are they placed in Boot-cljs?
It would work if the function tried to resolve file from classpath directories if it is not under user.dir
in temp directories, e.g. resources/foo.js
-> home/juho/.boot/cache/tmp/home/juho/Source/saapas/mv8/uanrg/foo.js
And home/juho/.boot/cache/tmp/home/juho/Source/saapas/mv8/uanrg/
is in classpath
The foreign library contents are resolved from classpath, so file path relative to classpath directory it is inside should be unique enough
Or well, they are first resolved from classpath, and then from working directory (using reader
)
@juhoteperi ok, how about a patch that uses classpath if the file isn’t a child of user.dir
Working on it
@dnolen OK if I delete add-package-jsons
entirely?
@anmonteiro go for it
it'll be in Git if we need to bring it back..
putting a patch together now
I'll let you know
@dnolen just attached a patch to http://dev.clojure.org/jira/browse/CLJS-1920
figured out why consuming React from NPM doesn't work with :none
just moving the assignment to after the function declaration fixes it: https://github.com/facebook/react/pull/8895/files
@anmonteiro got here to ask about exact same issue, we gonna fix React! 😄
@roman01la first the PRs need to be accepted 🙂
I'm confident they will, the changes looks fairly simple
yeah, also they do want to bundle React using Closure, so it makes sense to fix all these hacky JS things
right. I saw that, and it's a good thing that actually helps our side 🙂