This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-28
Channels
- # bangalore-clj (1)
- # beginners (67)
- # braveandtrue (179)
- # cider (28)
- # cljdoc (1)
- # clojure (132)
- # clojure-conj (3)
- # clojure-dev (1)
- # clojure-finland (6)
- # clojure-nl (2)
- # clojure-russia (6)
- # clojure-spec (19)
- # clojure-uk (62)
- # clojurescript (90)
- # clojutre (5)
- # component (2)
- # cursive (30)
- # data-science (1)
- # datomic (42)
- # duct (9)
- # emacs (1)
- # figwheel-main (158)
- # fulcro (57)
- # funcool (3)
- # hoplon (1)
- # jobs (17)
- # mount (38)
- # off-topic (15)
- # re-frame (53)
- # remote-jobs (2)
- # schema (11)
- # shadow-cljs (299)
- # spacemacs (25)
- # specter (2)
- # tools-deps (54)
- # vim (11)
- # yada (6)
@bhauman i was trying to use background builds before but then u just came out with the extra mains feature, so i switched quickly.
Hi, I can't work out how to use devcards with figwheel-main... Please post some config if you have it. Thanks
The very last step when I'm adding devcards to the mix is not complete, but I had it working in other repos so I will finish it up in the following few hours.
New demo app for Reagent SPAs based on fighwheel.main: https://github.com/pesterhazy/cljs-spa-example - comments welcome
Skimmed thru the readme. It's very exciting already to see a properly documented rationale! I will definitely dive deeper into it.
@pesterhazy the new :npm
feature could get rid of your need to do :foreign-libs
the assignment syntax in your library.js would have to change from window["React"] =
to window.React =
thanks! 🙂
Re: the dot syntax, given that many (most?) npm deps have dashes in their names, like react-select
, how does this work with the npm config option?
Right, I guess that ought to work in most cases
I'll give it a try
@bhauman Trying it now. One problem is that Reagent 0.8+ expects a dependency named "create-react-class", hence this line in the global-exports: https://github.com/pesterhazy/cljs-spa-example/blob/master/dev.cljs.edn#L7
Source line: https://github.com/reagent-project/reagent/blob/master/src/reagent/impl/component.cljs#L2
Also the npm
options seems to override rather than complement an existing :foreign-libs key. I tried to fix the "No such namespace: create-react-class" error like this:
:foreign-libs [{:file "doublebundle/empty.js",
:provides ["empty.empty"]
:global-exports {create-react-class createReactClass}}]
but that doesn't seem to have any effect@pesterhazy it doesn’t override the other foreign-libs but the ClojureScript compiler might
@pesterhazy I think the solution to this is simple
@pesterhazy if you look at the result of -pc
it should list both foreign libs entries
Hm... clojure -m figwheel.main -pc
doesn't take dev.cljs.edn into account, and clojure -m figwheel.main -b dev -pc
is invalid
gotcha
(the distinction between different classes of options is pretty subtle though, I guess inherited from cljs.main)
makes sense
@bhauman it works on a branch! https://github.com/pesterhazy/cljs-spa-example/pull/3
I had a typo before
the npm option creates these provides
{react React,
react-dom ReactDOM,
create-react-class createReactClass,
router5 Router5,
router5browser-plugin Router5BrowserPlugin,
noty Noty}
router5browser-plugin
is a bit surprising
not sure if there's a better way to mangle that name
I just fixed that number case but it shouldn’t matter, if you go back to the window["asdf"]
syntax
@bhauman you're right, it works, even with crazy node-style string requires with slashes: https://github.com/pesterhazy/cljs-spa-example/pull/4/files#diff-5f311029b08db38c3a95779d47930e57R5
@pesterhazy well that’s a little scary 🙂
great, I'll merge the PR once 0.1.9 gets released so people don't have to deal with SNAPSHOT versions
neat!
https://github.com/bhauman/figwheel-main/blob/master/src/figwheel/main/testing.cljc#L92
so if you (defn -main [& args] (run-async-tests 5000))
it will find and run all your tests
the only problem I have ot fix for this to be sweet is to allow you to launch whatever environment you want to run the tests in
I’m thinking about having a --launch-script
cli and figwheel option that can take the name of any script and it will receive either the url or path to the js to run
I could support one good option like chrome headless, but even then it takes a bunch of flags
but it would be great to just be able to run your tests without needing to start up node as an managing environment
yes that would be great
lein doo is quite fickle in my experience — I expect that there's a lot of complexity behind the scenes
@bhauman I created a branch for prod builds using figwheel main, seems to work great. See https://github.com/pesterhazy/cljs-spa-example/pull/6/files - curious if there's anything you'd do differently
because I wanted to use the same index.html
for prod and dev builds
and output-to defaults to cljs-out/dev-main.js
good point about -bo
, I thought I'd tried that but apparently not, it works now
is there a way to avoid duplicating keys like :foreign-libs
in prod.cljs.edn and dev.cljs.edn?
i know this will go away when the npm branch is merged, but this is just an example
I think I won't need that necessarily (the npm
option seems to work fine)
my question was about duplication configuration in two .cljs.edn files
oh yeah? *tries it*
I could even have -b common:dev
and -bo common:prod
nice, works like a charm
yeah me too. Visibility makes things much smoother
I'm convinced that fighweel main will be the best choice for most CLJS projects (browser, node, electron or RN) within the year
re-natal is basically Figwheel plus a small customization to the figwheel bridge
all the heavy lifting is done by Figwheel
so it should be relatively easy to port to figwheel main (famous last words)
hey @bhauman, It's silly question but what's the key name for figwheel configuration on lein ?
re-natal's file generation honestly I think I could live without. I'm not sure why it duplicated lein new
ah nice, I didn't know about that
I'm a bit confused. should I pass :output-to
to :cljsbuild
like lein-figwheel or to :figwheel
?
:watch-dirs
behavior - I’m assuming figwheel doesn’t want js files changes by default?
hey folks, when i run lein trampoline run -m figwheel.main -b dev -r
i get this error:
[Figwheel] Compiling build dev to "resources/public/js/compiled/app.js"
[Figwheel] Failed to compile build dev in 0.499 seconds.
[Figwheel] Compile Exception: com.cognitect.transit.TransitFactory.writer(Lcom/cognitect/transit/TransitFactory$Format;Ljava/io/OutputStream;Ljava/util/Map;Lcom/cognitect/transit/WriteHandler;Ljava/util/function/Function;)Lcom/cognitect/transit/Writer;
[Figwheel:SEVERE] java.lang.NoSuchMethodError: com.cognitect.transit.TransitFactory.writer(Lcom/cognitect/transit/TransitFactory$Format;Ljava/io/OutputStream;Ljava/util/Map;Lcom/cognitect/transit/WriteHandler;Ljava/util/function/Function;)Lcom/cognitect/transit/Writer;
[Figwheel] Starting Server at