This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-13
Channels
- # aleph (6)
- # architecture (29)
- # beginners (175)
- # cider (22)
- # clara (5)
- # cljdoc (5)
- # cljs-dev (28)
- # cljsrn (6)
- # clojure (62)
- # clojure-finland (7)
- # clojure-italy (7)
- # clojure-nl (2)
- # clojure-spec (23)
- # clojure-uk (194)
- # clojurescript (90)
- # core-async (2)
- # cursive (23)
- # datomic (41)
- # defnpodcast (2)
- # editors (4)
- # emacs (1)
- # figwheel-main (41)
- # fulcro (53)
- # hoplon (15)
- # hyperfiddle (4)
- # immutant (1)
- # jobs (7)
- # jobs-discuss (103)
- # lein-figwheel (9)
- # off-topic (34)
- # onyx (3)
- # parinfer (1)
- # portkey (1)
- # re-frame (7)
- # reagent (2)
- # remote-jobs (2)
- # rum (1)
- # shadow-cljs (148)
- # sql (54)
- # tools-deps (3)
- # vim (7)
I may be wrong, but I feel like the returned build-state from :compile-prepare and/or :compile-finished isn't ending up in the source code, be it watch or release. Just doing string/replace on the string of js resource (nested under :sources [:shadow.build.npm/resource "libcsound/libcsound.js"] :source
)
@hlolli what I would suggest is creating a libcsound/libcsound_browser.js
and then in package.json use a "browser":{"libcsound/libcsound.js": "libcsound/libcsound_browser.js"}
override
this will cause pretty much all JS build tools (including shadow-cljs) to include the libcsound/libcsound_browser.js
when building for the browser
https://github.com/defunctzombie/package-browser-field-spec#replace-specific-files---advanced
@thheller didn't know about this funtionality with "browser", sweet. Was hoping to avoid having two copies of that file. As it would essentialy mean two copies of the wasm binary as well.
Is what I'm trying to do, in build-state, assoc-ing-in :sources
a new source string, possible?
here my hook
(defn wasm2datauri
{:shadow.build/stage :compile-finish}
[build-state & args]
(let [resrc [:shadow.build.npm/resource "libcsound/libcsound.js"]
src (get-in build-state [:sources resrc :source])
wasm (string/trim (:out (sh "node" "libcsound/datauri.js")))
new-src (string/replace src "libcsound.wasm" wasm)]
(assoc-in build-state [:sources resrc :source] new-src)))
can I calculate sha256sum of the string and replace it with what the cache hash value?
do you have the code available somewhere? I kinda don't understand what exactly you are trying to do
I'm just trying to avoid having two different files, just create the file/string during compilation
trying to do this as part of the compilation itself just makes it 100x more complicated
then I have two 6mb files, 1 is js bindings files from emscripten, another .wasm, and when the .js file gets 6mb with the base64 string, it's hell to open and edit.
I strongly suggest however that you do whatever you need to do BEFORE shadow-cljs compilation starts
yes, your suggestion above, just use package.json script and create the file before, sounds clean to me
I have a lein project that I want to use shadow-cljs for, so I included [thheller/shadow-cljs "2.5.0"] in the project.clj deps. However now I get an Exception when I run lein cljsbuild once min:
Caused by: /home/paul/.m2/repository/cljsjs/create-react-class/15.6.0-1/create-react-class-15.6.0-1.jar deps.cljs refers to file not in jar: cljsjs/create-react-class/production/create-react-class.min.inc.js
[cljsjs/create-react-class "15.6.2-0"] [cljsjs/react "16.2.0-3"] [cljsjs/react-dom "16.2.0-3"]]
@pauld I would use react and react-dom from npm isntead of cljsjs when useign shadow-cljs
You can just provide it by providing the CLJS namespace.
Like this example: https://github.com/kurtharriger/shadow-cljs-reframe-template/blob/master/src/cljs/cljsjs/react.cljs
That way, your dependent library gets react in the namespace it expects.
they are provided by https://github.com/thheller/shadow-cljsjs
Caused by: The required namespace "cljsjs.material-ui" is not available, it was required by "qlkit_material_ui/core.cljs".
(ns cljsjs.material-ui
(:require ["material-ui" :as mui]))
(js/goog.exportSymbol "MaterialUI" mui)
but FWIW since you want build-reports anyways. material-ui is one of those huge packages
npm installing cljsjs dependencies, putting in excludes, wrapping where necessary and putting in only specific material-ui deps via npm install?
the problem is with qlkit. if that always imports the material-ui "meta" package which in turn includes everything else
-rw-rw-rw- 1 thheller thheller 1007K Feb 27 17:59 material-ui.min.inc.js
-rw-rw-rw- 1 thheller thheller 1.4M Feb 27 17:59 material-ui-svg-icons.min.inc.js
for the SVG icons its really important to only import the ones you actually use and not everything
qlkit-material-ui.core
is super small. you could probably rewrite it to only include what you need
the only thing that seems to be relevant is the (ql/regsiter-component ..)
call https://github.com/forward-blockchain/qlkit-material-ui/blob/master/src/qlkit_material_ui/core.cljs#L51
so (:require ["@material-ui/core/Button" :default Button])
and (ql/register-component :button Button)
may just work?
@lilactown no they cannot
I know I’m going to run into an issue eventually where two different experiences might have similar components, e.g.:
dashboard/livehelp
homepage/livehelp
I can simply use dashes instead of slashes, it’s not a huge deal. just aesthetically it would be nice to be able to namespace them
hmm, would there be any harm in adding a build hook that goes before :configure
, where I could modify :closure-defines
?
ah. I was trying to modify :shadow.build/config
, but those settings have already been locked-in elsewhere, so I can instead update-in build-state [:compiler-options :closure-defines]
@thheller Just wondering about the react-native support. Is this supported or on the roadmap?
@larshelg depends on what you expect to work. I do not use react-native myself and haven't done any work on the support in a while
There is an example: https://github.com/shadow-cljs/examples/tree/master/cljs-react-native-app
Well it would be great with repl/live-reload support. I dont know how hard it would be to implement. But seeing that there is partial support for RN it would be great to have it on the roadmap.
its on the roadmap yes. just don't know when I can get to it since I need to look into react-native stuff first
Yeah i found this: https://github.com/thheller/shadow-cljs/issues/214
thheller if I have time, I’d like to dig into the RN stuff. would you appreciate any help with that?
which however are very important but I couldn't even figure out if they are even supposed to work at all
https://github.com/facebook/metro/issues/104 nothing happened here so they still might not be supported