Fork me on GitHub
#re-frame
<
2022-02-26
>
fadrian19:02:53

Trying to debug re-frame app. Thought I'd try re-frame-10x. 10x keeps throwing an error:

[:dev] Build failure:
Invalid configuration
-- Spec failed --------------------

  {:target :browser,
   :compiler-options
   {:closure-defines
    {re-frame.trace.trace-enabled? true,
     day8.re-frame.tracing.trace-enabled? true}},
   :build-id :dev}

should satisfy

  has-either-chunks-or-modules?
Trying to figure out why this is happening because I've copied the config directly over from re-frame-10x's github page (other than adding the :target :browser to the :dev build because it was complaining about not having a :target). Any ideas what "has-either-chunks-or-modules?" means? The relevant spec bottoms out there with no idea of what that definition is. Or, even better, if someone could tell me how to fix my shadow-cljs.edn file to make this work, that would be great.

fadrian19:02:24

Adding shadow-cljs.edn file:

;; shadow-cljs configuration
{:source-paths
 ["src"]

 :dependencies
 [[reagent "1.1.0"]
  [re-frame "1.3.0-rc2"]
  [re-com "2.13.2"]
  [day8.re-frame/tracing      "0.6.2"]
  [day8.re-frame/re-frame-10x "1.2.2"]]

 :dev-http {32457 "public"}

 :builds
 {:client
  {:target :browser
   :output-dir "public/js"
   :asset-path "."
   :modules
   {:client
    {:init-fn atlas.main/main!}}}
   :devtools
   {:preloads [day8.re-frame-10x.preload]
    :target :browser}
   :dev
   {:target :browser
    :compiler-options
    {:closure-defines
     {re-frame.trace.trace-enabled?        true
      day8.re-frame.tracing.trace-enabled? true}}}
   :release
   {:target :browser
    :build-options
    {:ns-aliases
     {day8.re-frame.tracing day8.re-frame.tracing-stubs}}}}}
Thanks in advance for any help anyone can give me.

p-himik19:02:47

Wait. Why are you adding stuff from re-frame-10x's shadow-cljs.edn into your own shadow-cljs.edn?

p-himik19:02:38

Or what do you mean by "config" in this case?

p-himik19:02:50

Ah, after checking out the README I think I know what you mean. That section doesn't mean you need to copy the entire block into your shadow-cljs.edn. It specifically talks about only adding :closure-defines and :preloads in its description.

fadrian19:02:31

Because my shadow-cljs.edn file was relatively minimal with only a :client build. I figured by adding the re-frame-10x stuff, I could configure the build to work with 10x.

p-himik19:02:44

And what did your original config look like?

fadrian19:02:38

Something like this:

:builds
 {:client
  {:target :browser
   :output-dir "public/js"
   :asset-path "."
   :modules
   {:client
    {:init-fn atlas.main/main!}}}}}
Basically, a very minimal set of directives taken from the shadow-cljs documentation.

p-himik19:02:35

Notice how your original config has :modules but your modified config does not. And the spec function that errors out on the modified config is called has-either-chunks-or-modules?.

p-himik19:02:48

Oh, wait - I'm blind.

fadrian19:02:52

Yeah. My assumption is that the modules defined in the :client config would be inherited. I think I sort of (emphasis on the sort of) understand what the config is saying in the :devtools and :dev sections, but maybe I need to add the :module definition there, too.

p-himik19:02:00

• You don't need :target :browser under the :devtools key • Format your code differently, ideally not manually but with auto-formatter. Your braces are in the wrong places - shadow-cljs thinks that :dev is a build, whereas it, along with :release, should be within the :client build.

p-himik19:02:21

Also, don't no need to specify :target under the :dev and :release keys - those are overrides, no sense to duplicate info.

fadrian19:02:33

Thanks. I'll try that.

fadrian20:02:05

Thanks... That got rid of the build error and everything seems to be working. Thanks again.

👍 1