figwheel-main

figwheel-main http://figwheel.org
lepistane 2019-07-17T06:02:00.083500Z

i did clojure -A:fig:min and copied the content of target/public to resource/public (which feels wrong) and i get this in browser console

<http://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css:1|cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css:1> Failed to load resource: net::ERR_FILE_NOT_FOUND
07:57:09.041 dev-main.js:550 Success!
07:57:09.046 dev-main.js:98 Invariant Violation: Minified React error #130; visit <http://reactjs.org/docs/error-decoder.html?invariant=130&amp;args[]=undefined&amp;args[]=> for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 

lepistane 2019-07-17T06:29:56.083800Z

with optimization none i get

dev-main.js:3 GET file:///cljs-out/dev/goog/base.js net::ERR_FILE_NOT_FOUND
(anonymous) @ dev-main.js:3
08:29:24.959 dev-main.js:4 GET file:///cljs-out/dev/goog/deps.js net::ERR_FILE_NOT_FOUND
(anonymous) @ dev-main.js:4
08:29:24.959 dev-main.js:5 GET file:///cljs-out/dev/cljs_deps.js net::ERR_FILE_NOT_FOUND
(anonymous) @ dev-main.js:5
08:29:24.961 index.html:16 ClojureScript could not load :main, did you forget to specify :asset-path?
(anonymous) @ index.html:16
08:29:24.961 index.html:16 Uncaught ReferenceError: goog is not defined
    at index.html:16
(anonymous) @ index.html:16
08:29:24.963 index.html:16 Uncaught ReferenceError: goog is not defined
    at index.html:16
(anonymous) @ index.html:16
08:29:24.963 index.html:16 Uncaught ReferenceError: goog is not defined
    at index.html:16
what am i missing?

lepistane 2019-07-17T06:31:48.084700Z

i tried with bare template and it works so everything is packaged normally i have a feeling that semantic-ui lib i am using is breaking the compilation but why would it work on development then?

2019-07-17T07:14:04.084800Z

@christian767 I had the same issue when connecting with multiple devices to same figwheel instance. Only the last device was receiving the updates. Didn't try in the last months. Maybe sth changed. Try this -- https://figwheel.org/config-options#broadcast

2019-07-17T07:16:44.085100Z

It seems to work now, even if I didn't change anything. I think it works, but is perhaps a bit flaky, possibly due to aggressive background deprioritization by the browsers? If I interact with both clients on a regular-ish basis, they both stay up to date

practicalli-john 2019-07-17T07:32:09.088600Z

@lepistane you should only need to copy the single minified file from target, I believe its target/cljs-out/-dev-main.js by default Here is a video of how I deploy a ClojureScript and reagent project on GitHub pages https://youtu.be/nn_5NVgCps4?list=PLpr9V-R8ZxiDjyU7cQYWOEFBDR1t7t0wv

lepistane 2019-07-17T07:41:12.090Z

@jr0cket i narrowed it down to the dependency issue i started with clean figwheel main and deps and added semantic ui - and Invariant Violation: Minified React error #130 happened https://github.com/StankovicMarko/routes here is the repo if u can spot any issues

lepistane 2019-07-17T08:24:15.090600Z

i tried with re-frame template and it fails in the same way

practicalli-john 2019-07-17T10:12:00.092400Z

I am no expert, but I suggest trying it with a different optomisation level as it maybe causing issues. In your routes/deps.edn file, add another alias similar to line 12, except using simple compilation

:simple  {:main-opts ["-m" "figwheel.main" "-O" "simple" "-bo" "dev"]}

practicalli-john 2019-07-17T10:16:21.095900Z

the development build does not do any compiler optimisation, so you could also try "none" instead of "simple" to just get a single .js file as output. This give you a bit of time to find out why a dependency doesnt like a particular level of compiler optomisation. cljsjs should provide externs for the libraries you include as dependencies, so when the are minified and the names are all shrunk, the names in the javascript library will still work.

practicalli-john 2019-07-17T10:18:25.097600Z

not all javascript libraries will like going through the Google Closure compiler and unfortunately even though its a very powerful compiler, its not as common in the JavaScript world so doesnt get tested that much. Hope that makes sense...

lepistane 2019-07-17T10:23:21.099100Z

i did - but without success i would get https://clojurians.slack.com/archives/CALJ3BFLP/p1563344996083800 and also i managed to fix this using re-frame template but i needed to add

:infer-externs true 
:closure-warnings {:externs-validation :off :non-standard-jsdoc :off} 
:externs \["react/externs/react.js"\]
i tried to add those to dev.cljs.edn but i had no success

practicalli-john 2019-07-17T10:26:57.099800Z

Sorry, I have no idea, I am still very new to this.

lepistane 2019-07-17T16:40:06.102800Z

i narrowed it down to :advanced compilation with simple i needed to add few compiler options in order to make it work the package https://github.com/cljsjs/packages/tree/master/semantic-ui-react I think i am missing something extern or foreign lib or something in order to make it work