Fork me on GitHub
#shadow-cljs
<
2022-08-13
>
colinkahn06:08:10

Trying to compile a file with the following results in Cannot infer target type in expression (. (. Foo -prototype) -bar)

(deftype Foo []
  Object
  (bar [this] nil))
Tried this using cljs.main and didn't see any such warnings. Seems like it was addressed awhile ago in this ticket - https://clojure.atlassian.net/browse/CLJS-2862, and I'm using the latest shadow-cljs / clojurescript version

thheller06:08:10

@colinkahn I get no such warning. you sure you are on the latest versions? people often forget that the package.json version doesn't matter when using deps.edn/project.clj?

colinkahn06:08:36

I was double checking using --cli-info, which gives me:

=== Version
jar:            2.19.8
cli:            2.19.8
deps:           1.3.2
config-version: 2.19.8

thheller06:08:32

still doesn't tell you anything

thheller06:08:46

that only tells you about the shadow-cljs command itself

thheller06:08:51

do you use deps.edn or project.clj?

thheller06:08:58

the version you need is printed on startup

thheller06:08:18

I guess I should add a proper command for this

colinkahn06:08:43

I was compiling using npx , but I can setup a deps.edn file

thheller06:08:59

no, you do not need that.

thheller06:08:03

I'm just asking IF you use it

thheller06:08:23

ie. do you have a :deps or :lein key in shadow-cljs.edn?

colinkahn06:08:39

ah, no I do not

thheller06:08:01

ok then you are indeed on the latest version I guess

thheller06:08:14

in what context do you get that error?

thheller06:08:22

I just pasted that code into a file and get no errors/warnings

colinkahn06:08:52

I can get it from running npx shadow-cljs compile :app with a shadow-cljs.edn that looks like:

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

 :dependencies
 []

 :builds
 {:app {:target :browser
        :output-dir "public/js"
        :asset-path "/js"
        :modules
        {:main {:init-fn example.browser/init}}}}}

thheller06:08:19

and what is in example.browser?

colinkahn07:08:32

(ns example.browser)

(deftype Foo []
  Object
  (bar [this] nil))

(defn init []
  (js/console.log (Foo.)))

thheller07:08:52

hmm weird. I can reproduce it. checking

thheller07:08:37

hmm weird it appears to have something to do with AOT

thheller07:08:46

if you set :aot false in shadow-cljs.edn it goes away

thheller07:08:55

not sure why

thheller09:08:45

fixed in master, warning will be gone in next release

zimablue17:08:12

Hi, using shadow-cljs with a dependency on a library called membrane with this in the deps.edn:

:deps/prep-lib {:alias :build
                 :fn compile
                 :ensure "target/classes"}
and get this error:
Error building classpath. The following libs must be prepared before use: [com.phronemophobic/membrane]
cannot work out how to resolve it, clojure -X:deps prep doesn't appear to be doing anything

dpsutton17:08:58

can you share your deps.edn?

dpsutton17:08:14

I have a deps.edn like:

{:deps {io.github.phronmophobic/membrane {:git/sha "75d38cca6973a4cdd073d3c0a41cb7fb3f48ad77"}}}
and then the following terminal session:
❯ clj
Error building classpath. The following libs must be prepared before use: [io.github.phronmophobic/membrane]


/tmp/prep
❯ clj -X:deps prep
Prepping io.github.phronmophobic/membrane in /Users/dan/.gitlibs/libs/io.github.phronmophobic/membrane/75d38cca6973a4cdd073d3c0a41cb7fb3f48ad77
WARNING: compile already refers to: #'clojure.core/compile in namespace: build, being replaced by: #'build/compile
warning: [options] bootstrap class path not set in conjunction with -source 8


/tmp/prep
❯ clj
Clojure 1.11.1
user=> (doto 'counter require in-ns)
counter
counter=> (java2d/run #(counter @counter-state))
#:membrane.java2d{:repaint #object[membrane.java2d$run$fn__3719 0x38cf3ae1 "membrane.java2d$run$fn__3719@38cf3ae1"], :frame #object[javax.swing.JFrame 0x4f7bb8df "javax.swing.JFrame[frame0,0,38,80x28,layout=java.awt.BorderLayout,title=Membrane,resizable,normal,defaultCloseOperation=HIDE_ON_CLOSE,rootPane=javax.swing.JRootPane[,0,28,80x0,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]"]}
counter=>

zimablue17:08:59

just looking at what commit you're pointing at

dpsutton17:08:16

What do you mean?

zimablue17:08:36

was looking for that membrane git commit hash and it's ahead of the latest one I've pulled

zimablue17:08:49

I'll try with that version in a blank project

john19:08:03

Trying to test out SABs with shadow. I need to enable COOP/COEP for crossOriginIsolated and I've added this to my config:

:dev-http
 {8280 {:root "resources/public"
        :push-state/headers {"content-type" "text/html; charset=utf-8"
                             "Cross-Origin-Opener-Policy" "same-origin"
                             "Cross-Origin-Embedder-Policy" "require-corp"}}}
But js/crossOriginIsolated is still false. Is the only way to get this working by setting up https or am I missing something? I think I had it working in figwheel and I don't recall setting up any https certs.

thheller19:08:43

did you check if the headers are set?

👀 1
john19:08:26

I'm not seeing those particular ones in there

john19:08:08

Does it matter it's a 304?

thheller19:08:35

ah, no I think there is an open ticket about this

thheller19:08:44

the push-state headers are never used when index.html exists

thheller19:08:40

but I recommend using your own server anyways as soon as you need it to do any kind of custom stuff

👍 1