Fork me on GitHub
#figwheel-main
<
2018-08-13
>
bhauman11:08:26

OK now I'm looking into the Cannot find module '@cljs-oss/module-deps' problem that crops up when you add or remove dependencies while using global-exports

bhauman11:08:48

This also seems to lead to a race which prevents the global-export from binding to its munged name.

Karol W贸jcik12:08:06

@bhauman How does it happen that the (enable-console-print!) is no longer needed to print to the console using println?

bhauman12:08:25

the only way to get output to the REPL is to hook the *print-fn*

bhauman12:08:57

figwheel has to do this in order to print output to the repl

bhauman12:08:00

figwheel provides https://figwheel.org/config-options#client-print-to to determine where you want prints to go to

馃憤 4
bhauman12:08:34

enable-console-print! is a blunt instrument which obliterates these hooks

Karol W贸jcik12:08:30

Well my question is slightly different. I remembered from official Clojurescript articles that enable-console-print is needed to enable printing to the js console using println. Now with the newest clojure after successful compilation I can still println to the console without enable-console-print!. That's nice! But question is why?

Karol W贸jcik12:08:53

I thought it's obligatory to have it

bhauman12:08:00

OK its because figwheel has to make prints go to the REPL, so it has to change the *print-fn* and if it has to change the *print-fn* it might as well make prints go to the console as well because we are in development mode when we use figwheel.

bhauman12:08:12

figwheel has to alter how print works

bhauman12:08:25

if you want prints to go to the REPL

Karol W贸jcik12:08:24

Well sorry I was not accurate. I compiled the program with the cljsbuild. When I run the compiled program with node then the prints go to the console even if the enable-console-print! is not used. How does it happens? I remember that in the past it was not possible

bhauman12:08:45

OK that's not a figwheel thing, so I'm not sure

Karol W贸jcik12:08:52

I will try my luck on #clojurescript

Karol W贸jcik13:08:18

mfikes [3:23 PM]
@Karol W贸jcik It was 1.10.238 (`*print-fn*` automatically set):  (edited)
So maybe let's point in the README.md that starting from the 1.10.238 to ensure the correct behaviour in figwheel-main the user should avoid manually setting the enable-console-print because the print-fn is automatically set to js/console. What do you think @bhauman? I can prepare PR if you want 馃檪

bhauman14:08:19

big improvements to global-exports usage in 0.1.8-SNAPSHOT

馃嵑 20
鉂わ笍 8
馃殌 8
馃憤 8
parrot 12
lmarks21:08:09

Was just experimenting with figwheel-main. Haven't gotten a chance to condense for minimal reproduction yet, but just a heads up.... Was getting "[Figwheel] Compile Exception: Don't know how to write JSON of class java.io.File" errors when Figwheel reloaded after cljs change. Didn't find any additional info in the logs. Added clojure.pprint/pprint (Throwable->map e)) at https://github.com/bhauman/figwheel-main/blob/3fbeb0c/src/figwheel/main.cljc#L91 to see full stack trace. Cause was at https://github.com/bhauman/figwheel-core/blob/77bf8be/src/figwheel/core.cljc#L670 . The warning-infos contain a Java.io.File instance. So I think it will bomb attempting to reload whenever there are compiler warnings (which of course should be resolved anyway). e.g.

({:warning-type :single-segment-namespace,
     :line 1,
     :column 1,
     :ns cljs.user,
     :extra {:name dev},
     :message "dev is a single segment namespace",
     :file #object[java.io.File 0x3aa869be "devsrc/dev.cljs"],
     :file-excerpt
     {:start-line 1,
      :excerpt

bhauman21:08:24

this is good feedback, would love to know how this is happening.

bhauman21:08:44

basically when you allow load-warninged-code?

lmarks21:08:01

Hadn't explicitly specified a value for that.

lmarks21:08:28

Was calling figwheel.main.api/start in a script:

lmarks21:08:30

(apply figwheel.main.api/start (concat [{:open-url false
                                               :watch-dirs ["src" "devsrc"]
                                               ;:css-dirs ["../app/assets/stylesheets" "resources/public/admin/css"]
                                               :css-dirs []
                                               :target-dir "resources"
                                               :log-file "figwheel-main.log"
                                               :log-level :debug
                                               :mode :serve}]
                                       configs)))))

lmarks21:08:58

I'm getting the same error whether I explicitly set :load-warninged-code to true or false

dnolen21:08:28

is :http-server-root a thing still?

dnolen21:08:37

if not what replaces it?

lmarks22:08:18

My :single-segment-namespace was one of my :preloads. Taking it out of :preloads still gave the same "Don't know how to write JSON of class java.io.File" error in the browser, but in that case, it's pretty obvious because the compile warning is in the log output. Everything works as expected if I resolve the warning.

bhauman22:08:24

@lmarks so you had a single-segment-namespace named "dev"?

bhauman22:08:48

I can use that to test things

bhauman22:08:11

it's nowhere near as straight forward as :http-server-root but much more configurable

bhauman22:08:07

yeah I have to document this particual case

bhauman22:08:32

{:static {:resources "public"}}

bhauman22:08:04

supposedly :ring-stack-options {:static {:resources "public"}} will do the job

馃憤 4
lmarks22:08:04

@bhauman Generated a minimal app from clj -A:new figwheel-main figwheel-main.app --reagent and added a commit to reproduce.