Fork me on GitHub
#clojurescript
<
2018-04-23
>
gfredericks00:04:57

@mfikes I couldn't easily make a simple repro, but I had a local called goog and was just using it as the first arg to a protocol method; the code was broken till I renamed it to googx the error said that goog was undefined

steveb8n02:04:28

for anyone interested…. https://github.com/stevebuik/Stu

👍 4
aleksandr06:04:17

Hello everyone! Do anyone know how to enable an error stack trace from the clojurescript, not from the JS? Now I receive at the chrome console messages like this:

Uncaught TypeError: Cannot read property 'getHostNode' of null 
Further a long stack trace from JS
at Object.getHostNode (react-dom.inc.js:11615)
    at ReactCompositeComponentWrapper.getHostNode (react-dom.inc.js:4890)
    at Object.getHostNode (react-dom.inc.js:11615)
    at Object.updateChildren (react-dom.inc.js:4388)
    at ReactDOMComponent._reconcilerUpdateChildren (react-dom.inc.js:10455)
    at ReactDOMComponent._updateChildren (react-dom.inc.js:10559)
...

aleksandr07:04:07

Or why don`t figwheel write an error trace from very clojurescript files sometime?

roklenarcic07:04:08

I don't understand npm upgrading. I run npm i npm and it says + [email protected], but then I run npm -v and it says 5.6.0.

thheller08:04:00

@roklenarcic npm i -g npm otherwise you are installing in the current directory.

danielstockton08:04:11

Do :closure-defines always need to be defined in the goog namespace?

danielstockton08:04:43

I want to create two builds based on a compile time variable

danielstockton08:04:19

Blocks of my code should be exlcuded from one build, based on the value of this variable.

ingesol08:04:05

I would like to make a library wrapping a js-lib. I see that https://github.com/funcool/promesa did this by copying the js-source into its own source. Is there a smooth way to do this using npm-deps, so leiningen takes care of including the js dependency in the jar? The problem here is that the a library should be distributed as source code, and therefore won't have the cljsbuild step that would include the npm dep...

danielstockton09:04:55

{:closure-defines {bbb/admin? true}} and I'm able to refer to bbb/admin? in code. However, the compiler gives warnings like WARNING: WARNING - unknown @define variable bbb.admin_QMARK_ and no matter where I put ^boolean type hints in the code, I can't seem to get rid of (if bbb/admin?) blocks from the build

danielstockton09:04:56

Worked it out, wasn't quite getting it to start with. Need to use (goog-define ^boolean admin? false) to set the default value in the namespace, and then override with {:closure-defines {my.namespace/admin? true}} in project.clj

pradyumna12:04:03

hi i have a strange issue with dependency order. is there a way to ensure the order of load for included dependencies which do not have themselves specified a "requires" on each other. I am using CLJSJS package for adding MaterialUI and another package which requires js/MaterailUI to be present, but doesn't mandate in its specification. sometime it works but sometime it doesn't. If i include the js file directly using <script> in index.html, then it works fine. However, if I include it as leiningen dependency, then sometime I run into trouble when they are loaded in another order. Is it possible to force the order of load?

mfikes12:04:08

@pradyumna If you set it as a Leiningen dependency, then that puts it on the classpath, but then if you have no other references to it (say via :require or :foreign-libs) then presumably the only effect is that may add a deps.cljs on to the classpath. Something else should probably explicitly set a dependency on it so that the compiler can establish an order for it in the topological sort.

pradyumna12:04:21

thanks @mfikes i am not aware of deps.cljs, could you please point me to some reference on how to use it

mfikes12:04:02

This provides a mechanism by which dependency JARs can themselves specify upstream foreign dependencies.

mfikes12:04:24

My hunch is that, by including a CLJSJS JAR that specifies MaterialUI on your classpath, you get this dependency set up as a foreign lib, but nothing is explicitly consuming that foreign lib.

pradyumna12:04:47

@mfikes yes, that is the case. however both the libraries are third party jars, and i would prefer not to modify the jars themselves, rather do something on top of it

pradyumna12:04:25

my assumption was that in ns form the order of :require would ensure the order of load, but apparaently that's not happening

mfikes12:04:11

Yeah, if you look at the section right above that one, it shows how to use :require to consume a foreign lib.

pradyumna12:04:44

does this mean that, i should download the js files and include them in project folder, not use the dependency spec in lein project

mfikes12:04:54

No. It sounds like you have things set up correctly. Perhaps enabling the :verbose compiler option would shed some light on what is occuring.

pradyumna12:04:58

ok, i'll check that

dvcrn13:04:26

Hey guys! I’m having some issues in where chrome tells me my compiled cljs in my browser extension isn’t utf8, which it clearly is - https://stackoverflow.com/questions/49979397/chrome-says-my-content-script-isnt-utf-8

dvcrn13:04:46

anyone an idea why this is happening? I tried specifying utf8 in cljsbuild directly but same problem

dvcrn13:04:16

looks like turning on advanced compilation is fixing the issue, but now a lot of other things aren’t working 😄

pesterhazy13:04:19

@dvcrn I ran into the same issue building a chrome extension

pesterhazy13:04:15

add :closure-output-charset "us-ascii" to your :compiler options

dvcrn13:04:57

ohhh let me try this

dvcrn13:04:30

@pesterhazy it worked ❤️

dvcrn13:04:45

thanks a ton. I would have hunted for the issue for hours to come

pesterhazy13:04:50

you're welcome

orbjet19:04:47

hey just wondering, how does elm stack up against clojurescript? anyone knows ?

spinningtopsofdoom19:04:22

I've only played with Elm a little bit. Elm is easier to get started and more friendly to incoming devs and has error handling that tells you how to fix mistakes. JavaScript interop is through message passing. You tell Elm what data you want from a JavaScript library and then pass that data back to Elm (with types of course) The Arrays are ClojureScript Vector's and the dictionary is a Red Black Tree (no hash maps in Elm). There's no Type Class / Protocol abstraction so you can repeat yourself many times for bigger abstractions. The production builds use JavaScript tooling instead of Closure Compiler so the builds tend to be bigger.

spinningtopsofdoom19:04:16

I prefer ClojureScript for it's better datatypes, protocols, emphasis on data of code, having Google Closure Library as a JavaScript standard library, and JavaScript interop. I wish ClojureScript had the friendliness of Elm's errors and using the Google Closure Compiler can get quite frustrating to use with JavaScript libraries and get advanced compilation working.

orbjet19:04:16

@spinningtopsofdoom that's a great overview, thanks!

gklijs21:04:28

@shulc_ I did only a tiny bit Elm, but to complement @spinningtopsofdoom I would like to add two differences. While clojurescript is very stable, elm has breaking changes more often, but to do an upgrade it's well documented. Because if the types you often need more code, I read some comparison some while ago and Elm had by for the most loc of the tested frameworks, and about 10 times more as clojurescript.

neupsh23:04:29

Is there a way to step debug clojurescript code? preferably using cursive?

justinlee23:04:58

@neupsh I believe it is possible with https://github.com/binaryage/dirac but I have never tried

neupsh23:04:18

@lee.justin.m thanks, I did try dirac, works great most of the time, but for some reason sometimes it skips the breakpoint and I cannot see the values when I want 😞 (i think the code does not sync up sometimes)

neupsh23:04:22

I was wondering if I could just run a function in intellij's repl and have it hit the breakpoint 🙂 it would be so awesome

neupsh23:04:32

it does work for clojure but not for clojurescript

darwin23:04:29

@neupsh I think you can place manual breakpoint via js-debugger, this way you can work around DevTools confusion about generated javascript code: https://cljs.github.io/api/cljs.core/js-debugger

darwin23:04:26

you can also “join” Cursive’s REPL with Dirac REPL, this way you can stay in your IDE while issuing commands to Dirac REPL