Fork me on GitHub
#shadow-cljs
<
2017-10-10
>
mhuebert07:10:56

I tried deleting all the caches

mhuebert07:10:30

Could it be from having cljs in project.clj?

thheller07:10:45

can you track down which files causes those errors?

thheller07:10:24

File: :477:1 this is totally weird

thheller07:10:33

ah nvm, its actually cljs.core

thheller07:10:14

which makes this even weird since those warnings are actually correct

thheller07:10:31

why don’t they always appear 😛

thheller07:10:17

hmm no .. not correct .. nevermind

thheller07:10:38

do you get them for the :bootstrap build?

thheller08:10:45

I don’t get it … I never get those warnings. with lein or without

mhuebert16:10:14

what a mystery.

mhuebert16:10:25

I just pushed an update to shadow-eval which adds the cljs.js example. It still fails for me.. I even tried cloning shadow-eval fresh, yarn install and then shadow-cljs watch bootstrap browser. this is after a lein install of shadow-cljs master.

mhuebert16:10:02

and i see all the warnings.

thheller16:10:17

ha! I got them now too

thheller16:10:26

and now they are gone … what the heck

thheller16:10:29

can you confirm that this only happens ONCE on the initial compile and only when compiling both builds at once?

mhuebert16:10:27

yes, that’s correct. when re-building, I only see the cljs.core/uri? warning

mhuebert16:10:02

haven’t tried with only one build

mhuebert16:10:22

by ‘initial compile’ do you mean after removing the target folder

mhuebert16:10:56

remove target & watch bootstrap — no warning

mhuebert16:10:38

remove target & watch browser — only uri? warning

mhuebert16:10:52

remove target & watch browser bootstrap — all the warnings

thheller16:10:57

yes once the cache excists the warning disappears, which wis weird in itself since nothing is cached when warnings exist

thheller16:10:43

ok, but now I can reproduce this

thheller16:10:47

shouldn’t be long 😉

mhuebert16:10:06

🙂. could the cljs.js require error be related to this?

mhuebert16:10:55

when I compile the sample /dev project in shadow-cljs, it appears to work. but in shadow-eval I keep getting this error. staring at shadow-cljs.edn and the source, just can’t see anything of difference

thheller16:10:34

each build should be totally isolated, so no it should not be related

thheller16:10:54

but it might be … I’m really confused here 😛

thheller16:10:10

hmm I fixed something seemingly unrelated but now it seems fixed

thheller16:10:01

nope. restarting the process and its back

thheller16:10:22

------ ERROR -------------------------------------------------------------------
 File: jar:file:/Users/zilence/.m2/repository/org/clojure/clojurescript/1.9.946/clojurescript-1.9.946.jar!/cljs/core.cljs:673:1
--------------------------------------------------------------------------------
 669 |   "Protocol for accessing the metadata of an object."
 670 |   (^clj-or-nil -meta [o]
 671 |     "Returns the metadata of object o."))
 672 |
 673 | (defprotocol IWithMeta
-------^------------------------------------------------------------------------
 674 |   "Protocol for adding metadata to an object."
 675 |   (^clj -with-meta [o meta]
 676 |     "Returns a new object with value of o and metadata meta added to it."))
 677 |
 678 | (defprotocol IReduce
--------------------------------------------------------------------------------
Call to cljs.core/defn did not conform to spec
In: [1] val: G__34000 fails spec: :clojure.core.specs.alpha/arg-list at: [:args :bs :arity-1 :args] predicate: vector?
In: [1] val: G__34000 fails spec: :clojure.core.specs.alpha/args+body at: [:args :bs :arity-n :bodies] predicate: (cat :args :clojure.core.specs.alpha/arg-list :body (alt :prepost+body (cat :prepost map? :body (+ any?)) :body (* any?)))

--------------------------------------------------------------------------------

thheller16:10:32

what the heck is going on 😛

thheller17:10:04

there is definitely something going on with the threads, can’t quite figure it out yet

thheller17:10:19

------ ERROR -------------------------------------------------------------------
 File: jar:file:/Users/zilence/.m2/repository/org/clojure/clojurescript/1.9.946/clojurescript-1.9.946.jar!/cljs/core.cljs:693:1
--------------------------------------------------------------------------------
 689 |   (-kv-reduce [coll f init]
 690 |     "Reduces an associative collection and returns the result. f should be
 691 |      a function that takes three arguments."))
 692 |
 693 | (defprotocol IEquiv
-------^------------------------------------------------------------------------
 694 |   "Protocol for adding value comparison functionality to a type."
 695 |   (^boolean -equiv [o other]
 696 |     "Returns true if o and other are equal, false otherwise."))
 697 |
 698 | (defprotocol IHash
--------------------------------------------------------------------------------
Call to cljs.core/defn did not conform to spec
In: [1] val: G__32443 fails spec: :clojure.core.specs.alpha/arg-list at: [:args :bs :arity-1 :args] predicate: vector?
In: [1] val: G__32443 fails spec: :clojure.core.specs.alpha/args+body at: [:args :bs :arity-n :bodies] predicate: (cat :args :clojure.core.specs.alpha/arg-list :body (alt :prepost+body (cat :prepost map? :body (+ any?)) :body (* any?)))

--------------------------------------------------------------------------------

thheller17:10:26

this is not fun 😛

mhuebert17:10:06

doesn’t sound like it!

thheller17:10:17

there must be some race condition when compiling cljs.core

thheller17:10:36

something that should lock but doesn’t

thheller17:10:10

I’m absolutely lost … even if I lock and allow only compiling one form at a time I get this error

thheller17:10:44

I need a break, not the slightest idea what might be causing this.

thheller17:10:23

@mhuebert since you just brought it up in #cljs-dev, I totally want to hear about your experience with JS deps. but not now, head is too full.

mhuebert20:10:36

happy to discuss whenever

mhuebert20:10:53

I think I really like this ability to explicitly decide, for any given build, how to resolve a name

thheller20:10:18

following the discussion in #cljs-dev you seem to have the experience I had

thheller20:10:56

unclear semantics, “magic” symbols, conflict between npm-deps+foreign-libs

thheller20:10:51

whether or not something is in node_modules really shouldn’t have any impact on anything

thheller20:10:27

back to wrestling this race condition, can’t let that defeat me 😛

thheller20:10:46

only happens when compiling cljs.core at the same time in multiple threads. which should not be an issue since each thread has its own compiler env binding and should be totally isolated.

mhuebert20:10:09

I unfortunately don’t know anything about working with threads 😕

thheller20:10:56

seems like I don’t either 🙃

mhuebert20:10:06

is there a built-in way to init a new shadow-cljs project? not that it’s super necessary, as config is so simple, but 🙂

thheller20:10:27

shadow-cljs init

mhuebert20:10:32

oh should have looked!

mhuebert20:10:09

ah so this is done inside a fresh directory

mhuebert20:10:24

makes sense

thheller20:10:31

problem also goes away if I add (Thread/sleep (rand-int 2000)) before starting the build … fun times 🙂

thheller20:10:21

re init: I thought about creating a few small templates to make quickstart easier. even with the simplified config it still a bit of work to get started.

thheller20:10:17

its still way too hard to get started IMHO

mhuebert20:10:51

yeah, I am setting it up now and there are a few more steps than I remembered

mhuebert20:10:00

to get a dev server going, basic index.html, etc

thheller20:10:47

yeah something like chestnut to get all that going

mhuebert21:10:39

is there a way to specify in :js-options that react should be resolved to the node module?

mhuebert21:10:25

"react"
     {:target :npm
      :require "react/cjs/react.development.js"
      :require-min "react/cjs/react.production.min.js"}

mhuebert21:10:58

that still leaves me with The required namespace "react" is not available, it was required by "re_view/util.cljc".… would all upstream apps need to use string-require syntax for something like this to work?

thheller21:10:07

the symbols should work, I need to support that since CLJS supports it.

thheller21:10:30

does node_modules/react/cjs/react.development.js exist? I do not yet handle installing node deps

thheller21:10:09

so it might just be a bad error message?

mhuebert21:10:58

there is a note that React 16 is not yet supported

mhuebert21:10:05

so I think I will just do the ‘resolve’ way for now

mhuebert21:10:12

with a script tag

mhuebert21:10:26

or is that only if :js-provider :shadow is set?

thheller21:10:57

not yet supported by who? I tried it and will move my app into production with it tomorrow

mhuebert21:10:29

in shadow-cljs builds there was a note that the React 16 NODE_ENV require (or sth like that) is not supported

thheller21:10:49

right yes, thats why you need the :require and :require-min.

thheller21:10:21

otherwise they do this

thheller21:10:23

'use strict';

if (process.env.NODE_ENV === 'production') {
  module.exports = require('./cjs/react.production.min.js');
} else {
  module.exports = require('./cjs/react.development.js');
}

thheller21:10:51

which is a dynamic require which neither shadow or closure support

thheller21:10:11

the :resolve {"react" ...} should work, regardless of whether you do (:require [react]) or (:require ["react" :as react])

thheller21:10:51

did you verify that The required namespace "react" is not available, it was required by "re_view/util.cljc". has a node_modules/react/cjs/react.development.js in the project dir?

thheller21:10:18

if that file (and the other one) exists its a bad bug

thheller21:10:32

if if doesn’t exist its a bad error message

thheller21:10:39

either way something I want to fix

thheller21:10:44

verify that node_modules/react/package.json is from React v16 please

mhuebert21:10:43

I had either not installed or uninstalled react/react-dom

mhuebert21:10:02

i think that was just my fault

mhuebert21:10:07

it wasn’t in node_modules

thheller21:10:48

yeah, thats the issue with using react as a symbol

thheller21:10:06

I can’t decide if you mean a CLJS namespace or something that should be in node_modules

thheller21:10:44

if you use a string I KNOW that you are referring to a JS dependency

mhuebert21:10:27

yes exactly. i would like some explicit indication of whether a thing will resolve to node_modules or classpath. a “string-name” or npm/namespaced or something else. but now I have a strange error, it seems to be loading an old version of clojurescript despite a fresh project.clj, yarn install of shadow-2.0.8

richiardiandrea21:10:02

I have found using symbols for JS neat and confusing at the same time (pure personal feedback disclaimer)

thheller21:10:11

RuntimeException: Unable to find static field: INFERRED_CONST_CHECKS in class com.google.javascript.jscomp.DiagnosticGroups yes old version of something

thheller21:10:44

the deps are way too brittle, I need to fix this

thheller22:10:23

can you give me your :dependencies? I need a list I can reproduce this with.

thheller22:10:11

@richiardiandrea I prefer reliability over magic syntax sugar though 😉

thheller22:10:45

@mhuebert put shadow-cljs first in :dependencies

mhuebert22:10:31

ah, that was easy

thheller22:10:44

yeah, thats a lein thing I can’t do anything about 😞

thheller22:10:39

all libraries should use :scope "provided" when using clojurescript in :dependencies

mhuebert22:10:52

yeah I didn’t know about that till you mentioned it

thheller22:10:32

yeah, its usually not a problem since projects will have clojurescript themselves in :dependencies

thheller22:10:48

(which you could also do in this case)

mhuebert22:10:51

tiny feedback: if the dev server would print sth like localhost:THE_PORT when it starts, that’s a clickable link in my terminal

thheller22:10:30

Oct 11, 2017 12:09:35 AM clojure.tools.logging$eval15877$fn__15880 invoke
INFO: :shadow.cljs.devtools.server.dev-http/http-serve {:http-port 8705, :http-root out/public, :build-id :browser}

thheller22:10:46

thats supposed to be exactly that 😛

thheller22:10:05

need to fix this ugly logging style

mhuebert22:10:16

end of day for me. g’night

thheller22:10:32

still fighting the threads 😛

thheller22:10:16

luckily I can fix it without waiting for core to fix it

thheller23:10:30

@mhuebert btw I absolutely do not recommend using :lein true. that bypasses all optimizations I have done to improve startup times and makes everything way slower. makes sense when using a checkout dependency of shadow-cljs itself in a project but otherwise it should be avoided.

thheller23:10:45

Its a bit annoying that Cursive requires a project.clj to work properly. maybe I take care of https://github.com/thheller/shadow-cljs/issues/70 tomorrow.