Fork me on GitHub
#shadow-cljs
<
2020-11-27
>
cjsauer15:11:02

I’m having an issue getting shadow to ingest .js files. The use the import/export syntax as required, but they make use of a class with static fields, which for some reason is giving me a syntax error of “expecting a (“ after the field name. Is it possible that I need to tweak the closure compiler's input language setting? Commenting out all static fields allows compilation to succeed...

cjsauer15:11:34

I did try setting the :language-in compiler option to no avail.

thheller15:11:32

aren't static fields just a proposal for now?

thheller15:11:47

tweaking input language is not a thing since it is already at the highest level by default

3
thheller15:11:38

I don't have a clue whether they are supported or not. if you get a compiler error maybe not.

thheller15:11:41

if its not in any officially released JS versions then chances are good that its not supported. they often don't implement experimental features.

cjsauer15:11:04

Oh I didn’t even realize that! Thank you.

cjsauer15:11:07

I wonder, could I transpile this with Babel prior to feeding closure maybe?

thheller15:11:26

dunno. I'd just go for class Foo {} and Foo.field = 1; or whatever

cjsauer15:11:29

I didn’t write this code unfortunately. It’s generated. I’ll see if I can transform it prior to closure somehow. Thanks for the help.

jmckitrick15:11:10

For this error: ‘Cannot infer target type in expression’ is that Closure, shadow, or something else generating that message?

jmckitrick15:11:20

How can it be fixed?

jmckitrick15:11:48

Thanks, I’ll try that.

bendlas18:11:26

Hello, I just ran into some weirdness while porting a project from figwheel-main to shadow-cljs. Both only discovered because serving dev-http from classpath: :dev-http {9000 "classpath:www"}:

bendlas18:11:00

• shadow finds public/index.html from a dependency, instead of in resources/public/index.html. I suspect this is because of the hardcoded special-casing of folders named *resources, because it behaves correctly, when public/index.html is in different :paths directory

bendlas18:11:41

• when serving from classpath, the fallback to index.html necessary for client-routing, doesn't work as described in https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http.

bendlas18:11:57

I now realize that probably both could be worked around by serving from multiple file roots. Shall I create tickets?

mac18:11:03

I am having a pot of trouble shimming https://github.com/cljsjs/packages/tree/master/rrule so I can use https://github.com/reup-distribution/cljs-rrule. I have created a a shim like the below in src/cljs/cljsjs:

(ns cljsjs.rrule
  (:require ["rrule" :as rrule]))

(js/goog.exportSymbol "RRule" rrule)

mac19:11:58

But when I call cljs-rrule.core/rrule I get #object[TypeError TypeError: Cannot read property 'call' of undefined]

thheller19:11:46

@bendlas this likely has nothing to do with shadow-cljs but instead the ordering of the classpath by deps.edn

thheller19:11:14

shadow-cljs doesn't filter any folders when it comes to :dev-http. it just uses the classpath as constructed by clojure

thheller19:11:38

I don't know if that has been fixed but it didn't put :paths first for a while so the ordering was more or less random

👍 3
thheller19:11:59

well not random but different from shadow-cljs.edn and project.clj

thheller19:11:53

@mac sorry I don't know that package. check what rrule actually is in the REPL or so.

mac20:11:59

@thheller (type r/rrule) => nil

mac21:11:41

@thhellerI figured it out 🙂 I think the structure of the js package might have changed since the cljs lib was made.

Lyderic Dutillieux23:11:44

Hey guys, I'm thinking of reducing my modules footprint. I was wondering if it would be possible to get cljs.core and other core libs from a CDN ? I'm aware that I would lose tree-shaking capabilities, but since core libs are really stable, clojurescript is getting more and more popular and my project grows, using a CDN and client cache may be a good fit. Have anyone tried to setup this ?

lilactown23:11:52

I don't think anyone has tried this. you not only lose tree shaking, but also the advanced optimizations that the Closure compiler does for you such as variable renaming

👍 3