This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-11
Channels
- # asami (19)
- # babashka (41)
- # beginners (115)
- # biff (7)
- # calva (78)
- # clj-kondo (29)
- # cljs-dev (9)
- # clojure (39)
- # clojure-europe (17)
- # clojure-gamedev (29)
- # clojure-nl (1)
- # clojure-norway (9)
- # clojure-spec (2)
- # clojure-uk (3)
- # clojurescript (7)
- # core-async (26)
- # cursive (16)
- # datomic (13)
- # emacs (1)
- # events (5)
- # fulcro (2)
- # funcool (4)
- # gratitude (1)
- # helix (1)
- # holy-lambda (1)
- # humbleui (1)
- # introduce-yourself (4)
- # java (1)
- # jobs (2)
- # jobs-discuss (9)
- # lsp (28)
- # matcher-combinators (2)
- # mathematics (1)
- # membrane (1)
- # nbb (12)
- # off-topic (10)
- # pathom (52)
- # polylith (38)
- # portal (32)
- # re-frame (4)
- # reagent (16)
- # reitit (2)
- # remote-jobs (1)
- # reveal (1)
- # rewrite-clj (10)
- # sci (67)
- # shadow-cljs (45)
- # squint (1)
- # tools-build (13)
- # tools-deps (16)
I see a really strange behaviour in my shadow-clhs build. I’m using the :npm-module
target and the default :advanced
optimizations in a Release build.
The module output for clojure.string.js
changes depending on whether I use remove-watch
in my code or not.
Without, everything works fine, and the file’s second line starts like this:
'use strict';var Sl,Ul;$CLJS.Fh=function(a,b){return $};Sl=function(a,b){var c=Array(a.length-2);$CLJS.fc...
When I refer to remove-watch
, then this line looks like this, skipping the creation of the Fh
function:
'use strict';var Sl,Ul;Sl=function(a,b){var c=Array(a.length-2);$CLJS.fc(a,0,c,0,2*b);$CLJS.fc....
But $CLJS.Fh
is later used in the same file, e.g.:
$CLJS.ae.prototype.nd=$CLJS.Fh(27,function(a,b,c)...
And I get a JavaScript error that $CLJS.Fh
is not defined.
Took my a lot of time and frustration to narrow it down to remove-watch
… What’s special about that var? Any ideas?I noticed that the Fh
definition is moved to taoensso.encore.js
when I use remove-watch
, but this file is not required by clojure.string
of course
Why not pretty print it ?
Can’t remember the exact settings but configure it to not shorten the names, use the originals to get better insight
@U922FGW59 compile with npx shadow-cljs release <your-build> --pseudo-names
OK, will try that, thanks. Was confused that things are moved to modules with the wrong dependency relationship, as encore depends on clojure.string and not vice versa
if a function is only used once somewhere the closure compiler will either inline it entirely or move it to the module it was used in
you might be chasing down the wrong problems. advanced can be very misleading that way 😛
It might, but the Fh
definition is exactly the same. And anyway, I do get the problem that clojure.string
uses this but does not have it
The function Fh
is this:
$CLJS.$JSCompiler_unstubMethod$$ = function($JSCompiler_unstubMethod_id$$, $JSCompiler_unstubMethod_body$$) {
return $CLJS.$JSCompiler_stubMap$$[$JSCompiler_unstubMethod_id$$] = $JSCompiler_unstubMethod_body$$;
};
What is it? 🙂
haven't seen that problem in a long time though. not sure how clojure.string would be involved either
Ah, I had that in a different project once, I remember…
Do you know what unstubMethod does?
In my case probably totally useless, as I later use webpack to glue it all together
Yeah, I do use shadow.modern/defclass
and foo
is only used on one module but Thing
in multiple. it may move the definition of foo
elsewhere
if you run webpack anyways you should probably consider using :target :esm
with :js-provider :import
Not sure if I can. You might not remember, but you were helping me back in the day with my setup to build VS-Code Web Extensions
Where I need a special web-worker build that uses require and module exports
Yep, needs all in one file
Unfortunately I cannot keep the differences between ESM/whatever other JS module version in my head 🙂
Ok dam if there was an award for rapid esoteric knowledge and response this would be it
I’d probably have to tell my boss this is a research project and I’ll see you in a few months
Yes, thanks Thomas, your help is highly appreciated!
Fun fact: I actually worked around not needing remove-watch
in the end and came up with a better design anyway
Thanks again!
It seems like passing the NPM package mermaid through shadow-cljs might corrupt it somehow. The DOM elements added by mermaid after it has been passed through shadow-cljs come out malformed compared to the elements that come out when you add mermaid to the page directly via a script tag. Here’s https://github.com/zane/shadow-cljs-mermaid-repro.