Fork me on GitHub
#figwheel-main
<
2019-07-17
>
lepistane06:07:00

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

 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  for the full message or use the non-minified dev environment for full errors and additional helpful warnings. 

lepistane06:07:56

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?

lepistane06:07:48

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?

practicalli-johnny07:07:09

@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

lepistane07:07:12

@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

lepistane08:07:15

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

practicalli-johnny10:07:00

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-johnny10:07:21

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-johnny10:07:25

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...

lepistane10:07:21

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-johnny10:07:57

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

lepistane16:07:06

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