Fork me on GitHub
#clojurescript
<
2018-02-16
>
jdormit00:02:15

Does anyone know if it is possible to use :optimizations :none and still get a single file? I don’t mean using :main, which outputs a file that pulls in additional files from out via document.writeing <script> tags - I mean actually just getting one JS file that defines goog and does all the other work necessary to bootstrap cljs

anmonteiro01:02:55

@jeremy.dormitzer you’re probably looking for :optimizations :whitespace

jdormit01:02:21

Will that work with figwheel? The docs say it has to be :none.

jdormit01:02:03

Plus, :whitespace compiles way slower than :none since it still passes through the closure compiler

gklijs06:02:53

@jeremy.dormitzer I don’t think you can both get figwheel to work, and have a single file, what do you want to do?

hlolli12:02:49

@jeremy.dormitzer if you’re willing to go some distance to achieve this, then I made a chrome extension build task for shadow-cljs that compiles unoptimized code into 1 file https://gist.github.com/hlolli/265b9183566a4c5829d7ee355e3d0998#file-chrome_extension-clj-L47-L52 you could make something similar.

jdormit14:02:49

Ha yes, Chrome extensions were exactly the use case for this. I ended up putting together a build system that separates dev resources from prod resources so that I can have unoptimized code with figwheel for dev with a custom manifest.json to support that, and an optimized / single file build for prod with a manifest.json that will get accepted by the app store (no custom CSP)

jdormit14:02:55

Thanks for the suggestions, everyone!

jrbrodie7716:02:46

I'm doing some work using the AWS JS SDK from cljs. I'm using clairvoyant to trace, and I've noticed that some of the JS objects are displayed with Clojure keywords, but are actually only accessible using JS string keys. Do I have a configuration problem? some kind of conversion hapenning en-route to the console?

hlolli16:02:47

@jrbrodie77 you must have some clj to js conversion problem. If you have access to this object, did you try doing (clj->js {:edn "data"}) or #js {:edn "data"} (#js is non-recursive)

hlolli16:02:12

clj->js - function
(clj->js x & {:keys [keyword-fn], :or {keyword-fn name}})
Recursively transforms ClojureScript values to JavaScript.
sets/vectors/lists become Arrays, Keywords and Symbol become Strings,
Maps become Objects. Arbitrary keys are encoded to by key->js.

neupsh18:02:31

Has anyone used clojurescript with maven based java projects?

neupsh18:02:07

I was wondering how would one go about running cljsbuild as part of maven build

Alex Miller (Clojure team)19:02:46

@neupsh there are no great pathways for this and it depends exactly what you want to do. If you’re just packaging, then that’s not too bad. for tests, the best I’ve seen is data.xml, which uses nashorn to integrate it. but most of the contrib projects using clojurescript have a lein file that is used in tandem.

neupsh19:02:10

I am trying to convert a maven based project (spring boot), to leiningen based one with clojure and clojurescript added in the project (java, clj, cljs polyglot)

neupsh19:02:33

hopefully i can convert it to project.clj and i will have more options then

tomthought20:02:07

Is anyone else having advanced compilation issues with a fresh re-frame and/or reagent project, on a machine with JDK 9?

tomthought20:02:08

Tiny bit more info: 1. Fresh project created a few minutes ago using re-frame template (https://github.com/Day8/re-frame-template) 2. Added :jvm-opts [“--add-modules” “java.xml.bind”] to :dev profile Otherwise everything is exactly as found in the template generated project.

mfikes20:02:21

@goldsmith.tee Yes, FWIW, there is a failure in the ClojureScript unit tests surrounding Java 9 and :advanced: https://dev.clojure.org/jira/browse/CLJS-2400

tomthought20:02:41

@mfikes That definitely looks like it could be the cause. Thanks for the link.

mfikes20:02:15

@goldsmith.tee The unfortunate aspect is that it smells like Java 9 can't run Closure

tomthought20:02:29

@mfikes That’s a pretty big deal. Damn.

mfikes20:02:08

Perhaps the issue is isolated to some of the code that ClojureScript generates

tomthought20:02:38

That would be ideal yeah. Might stick with Java 8 for now.

raul.guajardo21:02:15

Hi everyone, new to Clojure/Script. Would anyone happen to have a good reference or project with examples on how to modify cljs.test/report, trying to get a report that can be integrated to a CI build that shows tests and code coverage. Kinda like a junit.xml like from test2junit but for clojurescript