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...
I did try setting the :language-in
compiler option to no avail.
aren't static fields just a proposal for now?
tweaking input language is not a thing since it is already at the highest level by default
I don't have a clue whether they are supported or not. if you get a compiler error maybe not.
if its not in any officially released JS versions then chances are good that its not supported. they often don't implement experimental features.
Oh I didn’t even realize that! Thank you.
I wonder, could I transpile this with Babel prior to feeding closure maybe?
For this error: ‘Cannot infer target type in expression’ is that Closure, shadow, or something else generating that message?
How can it be fixed?
https://shadow-cljs.github.io/docs/UsersGuide.html#infer-externs
Thanks, I’ll try that.
dunno. I'd just go for class Foo {}
and Foo.field = 1;
or whatever
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.
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"}
:
• 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
• 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.
I now realize that probably both could be worked around by serving from multiple file roots. Shall I create tickets?
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)
But when I call cljs-rrule.core/rrule I get #object[TypeError TypeError: Cannot read property 'call' of undefined]
@bendlas this likely has nothing to do with shadow-cljs but instead the ordering of the classpath by deps.edn
shadow-cljs doesn't filter any folders when it comes to :dev-http
. it just uses the classpath as constructed by clojure
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
well not random but different from shadow-cljs.edn and project.clj
@mac sorry I don't know that package. check what rrule
actually is in the REPL or so.
@thheller (type r/rrule) => nil
@thhellerI figured it out 🙂 I think the structure of the js package might have changed since the cljs lib was made.
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 ?
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