Fork me on GitHub
#shadow-cljs
<
2020-05-01
>
beders00:05:39

for most changes other than dependencies it seems to just magically work for me

AJ Snow00:05:51

oh snap you're right. It looks like I just needed to save changes and switch windows.

thheller06:05:10

build config changes should be automatically applied yes

thheller06:05:27

just dependencies, source-paths and some others like nrepl require a restart

andre08:05:13

hi, what would be the better way to solve this

[2020-05-01 10:47:31.625 - INFO] duplicate resource taoensso/timbre.cljs on classpath, using jar:file:/.m2/repository/com/taoensso/timbre/4.10.0/timbre-4.10.0.jar!/taoensso/timbre.cljs over jar:file:/.m2/repository/status-im/timbre/4.10.0-2-status/timbre-4.10.0-2-status.jar!/taoensso/timbre.clj
[2020-05-01 10:47:31.640 - INFO] duplicate resource taoensso/timbre/appenders/core.cljs on classpath, using jar:file:/.m2/repository/com/taoensso/timbre/4.10.0/timbre-4.10.0.jar!/taoensso/timbre/appenders/core.cljs over jar:file:/.m2/repository/status-im/timbre/4.10.0-2-status/timbre-4.10.0-2-status.jar!/taoensso/timbre/appenders/core.cljs
at least do not show this info, this duplication we only have in dev

thheller09:05:29

why would it not show this info? seems kinda important?

thheller09:05:02

I mean if you intent is to override that file then its kinda important to know that is not happening?

andre09:05:40

yeah its important I'm not arguing 🙂

andre09:05:27

is there something like :exclusions ?

thheller09:05:01

what is the issue? I don't quite know what you are trying to solve here?

conan11:05:35

Hi, I run the following script in Cursive to start shadow-cljs:

(require
  '[shadow.cljs.devtools.api :as api]
  '[shadow.cljs.devtools.server :as server])
(server/start!)
(api/watch :app)
(api/repl :app)
We've recently made some build changes and bumped shadow's version, and I cannot get this to start any more. I get errors like Syntax error (NoSuchFieldError) compiling at (shadow\cljs\devtools\api.clj:1:1) ES3 and Assert failed: (symbol? read-ns) Any ideas on what I'm doing wrong?

Thijs Creemers12:05:11

Is there a prefered way to merge multiple shadow-cljs projects into one :browser UI? We plan to create UI components per service and merge them together to get a frontend app that communicates to their respective services?

thheller13:05:18

@conan that is due to a version conflict. need to resolve your conflicts. most likely a mismatched clojurescript version and maybe closure-compiler/closure-library.

conan13:05:03

ah, ok i'll check that. thank you, have a great weekend!

thheller13:05:43

@thijs.creemers if you are asking about combining multiple builds into one single UI then there is no support for that CLJS in general is not suited for that

thheller13:05:02

if you are talking about creating multiple libraries/components and using them to build one UI that is fine

Thijs Creemers13:05:51

@thheller Thank you for the answer. So the way to go for is making a UI library/component per service and combine them in one frontend app.

thheller13:05:08

I guess? Don't know enough about what you are trying to do. Loading multiple different builds on the same page will give you nothing but trouble so you should only load one, that is the only advice I can give without more info

Thijs Creemers13:05:05

You are right, I did some experiments and foud that it is trouble indeed.

Thijs Creemers13:05:18

I will give it a try with cljs libraries.

mauricio.szabo15:05:52

Everytime I post an issue on Shadow-CLJS, I feel the strenght of this project: most of the time, the bug is not on shadow, but on some dependency that I hardcoded my project... great job! 🙂

💯 4
thheller15:05:34

yeah I wish there were an easy way to sort out dependency issues 😞

thheller15:05:14

its the most common issue people have but I have no idea how to fix it given that shadow-cljs is not always in charge

mauricio.szabo15:05:20

Do you think it's possible for shadow-cljs to just remove the conflicting dependencies it finds from :depencies vector?

mauricio.szabo15:05:35

(and issue an warning, or something?)

thheller15:05:59

already doing that for clojurescript/clojure

thheller15:05:20

don't want to hardcode too much since newer versions rarely are an issue

Spaceman19:05:56

Is there a cljs test runner that works on emacs and not in the browser that offers good navigation between tests and simplifies information about which tests passed and which failed?l

isak19:05:38

Anyone see any compiler/caching related issues with this code? Inside a translation macro:

(when env/*compiler*
      (validate-consistency! @env/*compiler* i18n-call) ;; The new thing
      (swap! env/*compiler* update-in [::ana/namespaces current-ns ::i18n-calls] vec-conj i18n-call))
That function:
(defn validate-consistency! [compiler i18n-call]
  (let [other-i18n-calls (for [[_ ns-data] (::ana/namespaces compiler)
                               i18n-call (::i18n-calls ns-data)]
                           i18n-call)
        conflict (some
                   (fn [other-i18n-call]
                     (get-conflict i18n-call other-i18n-call))
                   other-i18n-calls)]
    (when conflict
      (throw
        (ex-info
          (str
            "Translation calls with the same arguments cannot have differing translations.\n"
            (pr-str (:msg i18n-call))
            "\nvs.\n"
            (pr-str (:msg conflict)))
          {:translation i18n-call
           :conflicting-translation conflict})))))
cc @thheller

thheller19:05:05

@isak I see a lot of issues yes 😛

isak19:05:28

😬

thheller19:05:42

unless the namespace that uses that depends on every other namespace this is checking you'll run into a lot of timing issues

thheller19:05:52

parallel compile might still be compiling namespaces and so on

isak19:05:17

Ok, but will that affect anything other than which callsite receives the error? because that doesn't matter in this case

thheller20:05:02

I have no idea in which context you are using this or what ::i18n-calls represent so I cannot comment on that

thheller20:05:34

throwing an error based on other namespace data seems like a problem to me and would probably be something I would do as a post-compile hook

thheller20:05:25

in general macros shouldn't do side effects like that IMHO

isak20:05:14

The i18n-calls are just the data captured from macro invocations like this: (tr [:api-token/confirm-delete "Are you sure you want to delete this API token?"])

isak20:05:10

So I would like to throw an error if there are two translation calls that have the same namespaced keyword, but different text. Can this be done in a post-compile hook?

isak20:05:04

Would it actually stop compilation, or just print a message to the console or something?

thheller20:05:23

hook into :compile-finish and throw the error if it finds one

isak20:05:13

Ok, I'll fix it, thanks

thheller20:05:17

the build-state argument has a :compiler-env key

thheller20:05:35

that is the value you'd otherwise get out of the @env/*compiler* atom, so it has the ::ana/namespaces

isak20:05:57

ok, right

knubie20:05:23

@thheller I did some digging into my websocket/cordova issue today.

knubie20:05:05

I’m using ionic wkwebview plugin which serves up the index.html from a server.

knubie20:05:14

In the plugin settings you can set a custom hostname.

knubie20:05:35

If I set a hostname like foo.bar, I get a websocket error like: WebSocket network error: WebSocket connection failed because it violates HTTP Strict Transport Security.

knubie20:05:31

And the websocket url is …/browser

knubie20:05:40

But changing the hostname back to localhost works without issue.

knubie20:05:00

Not sure if this is something shadow-cljs can/should fix or just something I need to fix through my own configuration.

knubie20:05:06

Just thought I’d let you know what I found out.

knubie20:05:42

This is in iOS btw, so it might be specific to safari.

thheller20:05:18

shadow-cljs default to using js/document.location.host when trying to figure out what it should connect to

thheller20:05:44

you can use :devtools {:use-document-host false} to use localhost instead

thheller20:05:54

or you can use :devtools-url to override the url completely https://shadow-cljs.github.io/docs/UsersGuide.html#proxy-support

knubie20:05:00

Wow, there’s an option for everything haha

knubie20:05:05

that’s great, thanks

Pavel Klavík23:05:55

Hi, I am having some problems with code reloading. I have multiple defs scattered in multiple namespaces, all contained in one def called config which is used in mount-root for rerendering. When I do changes in one of the namespaces included into config, Shadow-cljs logo appears but the value is not propagated into config. If I change the config itself, the value is finally propagated. How does this work?

Pavel Klavík23:05:18

It seems it does not work when I do transitive change, i.e, config contains the symbol a in ns a, which contains the symbol b in ns b, then updating b does not change config.

Pavel Klavík23:05:33

not sure whether it makes any difference, but everything is placed in .cljc namespaces.

Pavel Klavík23:05:17

Looking at the console, only namespaces a and b are reloaded, not the one with config

Pavel Klavík23:05:27

Adding ^:dev/always to the config namespace fixes the problem, but not sure why it happens