Fork me on GitHub
#shadow-cljs
<
2020-02-23
>
sheluchin13:02:53

Can anyone tell me why I'm getting the error at the top?

[2020-02-23 08:51:46.509 - WARNING] provide conflict for #{sheluchin.client} provided by app/sheluchin/client.cljs and {"/sheluchin/client.cljs" #{sheluchin.client}}


{:lein {:profile "+dev"}
 :nrepl     {:port 9000}

 :dev-http  {8000 "resources/public"}

 ; Ignored since :lein is set
 ; :source-paths ["src/app"]

 :builds    {:main      {:target        :browser
                         :output-dir    "resources/public/js/main"
                         :asset-path    "/js/main"
                         :dependencies  [[cider/piggieback "0.4.1"]
                                         [fipp "0.6.21"]]
                         :repl-options  {:nrepl-middleware [cider.piggieback/wrap-cljs-repl]}

                         :modules       {:main  {:init-fn sheluchin.client/init}}
                         :devtools      {:after-load sheluchin.client/init
                                         :preloads    [com.fulcrologic.fulcro.inspect.preload]
                                                       ; sheluchin.app.core-test]
                                         :repl-pprint true}
                         :compiler-options {:external-config {:guardrails {}}
                                            :closure-defines {'goog.DEBUG true}}}}}

(defproject app "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url ""}
  :dependencies [[org.clojure/clojure "1.10.0"]
                 [com.fulcrologic/fulcro "3.0.1"]]
  :main ^:skip-aot sheluchin.client
  :target-path "target/%s"
  :source-paths ["src/app"]
  :profiles {:uberjar {:aot :all}
             :dev {:source-paths ["src/app"]
                   :dependencies [[org.clojure/clojurescript "1.10.597"
                                    :exclusions [com.google.javascript/closure-compiler-unshaded]
                                                org.clojure/google-closure-library
                                                org.clojure/google-closure-library-third-party]
                                  [thheller/shadow-cljs       "2.8.83"]
                                  [binaryage/devtools         "0.9.10"]]}})

sheluchin13:02:54

Invalid Filename, got app/sheluchin/client.cljs but expected sheluchin/client.cljs (or .cljc)

   1 | (ns sheluchin.client

   2 |   (:require

   3 |     [com.fulcrologic.fulcro.application :as app]

   4 |     [com.fulcrologic.fulcro.components :as comp :refer [defsc]]

   5 |     [com.fulcrologic.fulcro.dom :as dom :refer [div h1 h2 h3 button ul li]]

sheluchin14:02:03

I have :source-paths ["src/app"] set, so ns sheluchin.client should correspond to src/app/sheluchin/client.cljs, no?

thheller14:02:47

it should. did you restart lein/shadow-cljs after changing the paths?

thheller14:02:00

(if you changed the paths while it is runing they won't apply)

sheluchin14:02:53

Hmm, thought I did that last time too, but doing it again for good measure seems to have fixed it.

alidlorenzo22:02:36

is tree shaking for node_modules not turned on by default? I'm running a build report and seeing that all of react-native-web (300kb 😬) is being included even though I'm only using a portion of it. reading docs it says advanced optimizations are only done if :js-provider is set to closure . which I imagine is the issue here. but if some of my other packages aren't compatible with closure compiler, is there way way to exclude them from advanced optimization, or to specifically include the packages I want optimized?

alidlorenzo22:02:51

also looks like all of clojurescript itself is being included (i.e. pprint and spec are bundled).. though not sure if that's bc other cljs deps are depending on it

lilactown22:02:25

In general external JS can't be tree shaken / DCE'd

alidlorenzo22:02:01

ah so any JS package you include will include all its exports? i imagine we can’t post process cljs output with babel either :thinking_face: any workarounds for this?

lilactown22:02:34

Often in large libs you can include just the files you need

🆗 4
thheller08:02:14

not all CLJS code is compatible with DCE either. thats why you see pprint and spec

thheller08:02:50

as for JS your requires should be as exact as possible (if possible at all)

zilvinasu22:02:23

anyone successfully using shadow-cljs with emacs clojure-lsp with project generated npx create-cljs-project ? go to definition for the libs does not seem to work (:require [reagent.core :as r]) i.e. can’t jump to reagent code

dpsutton22:02:27

How recent is your clojure-lsp? I think the patch to understand shadow-cljs project landed a few days ago. Also the parser hasn’t been updated for strings in the ns require form yet

zilvinasu22:02:48

might be too old in homebrew, will try to install manually, thanks!

dpsutton00:02:52

Did that help?

zilvinasu08:02:18

seems like homebrew formula is using this one: https://github.com/snoe/clojure-lsp/releases/tag/release-20200121T234305 so it is kind of the latest according to the github, though reinstalling it made it crash every time now

zilvinasu08:02:22

Pulled the repo and done lein bin to get the recent bin, since the one that is provided is not up to date, works now, thanks!