This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-11
Channels
- # adventofcode (52)
- # announcements (3)
- # aws (2)
- # babashka (36)
- # babashka-sci-dev (4)
- # beginners (69)
- # biff (45)
- # calva (9)
- # cider (3)
- # clara (8)
- # clj-kondo (24)
- # clojure (20)
- # clojure-dev (12)
- # clojure-europe (12)
- # clojurescript (2)
- # conjure (1)
- # emacs (17)
- # lsp (69)
- # malli (12)
- # off-topic (32)
- # polylith (2)
- # re-frame (4)
- # releases (2)
- # scittle (6)
- # shadow-cljs (21)
- # tools-deps (10)
- # vim (11)
- # xtdb (11)
I'm trying out using https://shadow-cljs.github.io/docs/UsersGuide.html#classpath-js. This compiles and works:
export class Test {
static foo = "bar";
static staticMethod() {
alert(this === Test);
}
}
But I'm wondering why because
> The Closure Compiler is used for processing all JavaScript found on the classpath using its ECMASCRIPT_NEXT
language setting.
and the https://github.com/google/closure-compiler/issues/2731? I just want to make sure I'll not encounter issues if I go down this path.Thanks. Related, your modern/defclass
macro doesn't support static fields as well, correct? So would use something like (set! (.-foo Class) "bar")
?
shadow-cljs release
compiles this without warnings
/**
* @nocollapse
*/
export class Test {
static foo = "bar";
static staticMethod() {
alert(this === Test);
}
baz = "blah";
}
And this works
(js/console.log
(.staticMethod Test)
(.-foo Test)
(.-baz (new Test)))
Is that a sufficient test? I still think this must be wrong somehow 🙂@nocollapse
was to remove a warning. Actually, without it there was an error at runtime.
I have a TS file with a class (with static props and methods) which extends from an npm package. I converted that file into JS, compiled with release
and it still seems to work. I guess I'll proceed 🙂
I tried to add chakra-ui to my cljs (based on fulcro template) project. However, I get the following error:
Errors encountered while trying to parse file
/Users/abcd/projects/abcd/editor/node_modules/@chakra-ui/utils/dist/index.cjs.js
{:line 999, :column 10, :message "'(' expected"}
When I inspect the mentioned file I see a normal JS class:
// src/pan-event.ts
var PanSession = class {
history = []; // this is line 999 <------------------------------------
startEvent = null;
lastEvent = null;
lastEventInfo = null;
handlers = {};
removeListeners = noop;
threshold = 3;
win;
constructor(event, handlers, threshold) {
this.win = getEventWindow(event);
if (isMultiTouchEvent(event))
I don’t know why this is not compiling. Is this not supported or do I missed some configuration?for such huge UI libs its usually best to stay with webpack as described in this post https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html#option-2-js-provider-external