clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
mruzekw 2020-09-15T00:00:58.485800Z

Thanks!

thheller 2020-09-15T06:49:36.486800Z

https://gist.github.com/thheller/fa044450a6470fdd1afdbcf3f37a65e3

šŸ‘ 1
thheller 2020-09-15T06:49:41.487Z

is another way

Elso 2020-09-15T09:36:30.489500Z

I've got this recurring problem where every few days my app breaks on calls into a node module with TypeError: $jscomp.inherits is not a function and up until now I could always resolve it by bumping either CLJS versions or those of the node module, but now both are up to date and a few days in the error reappeared and I don't know what to do about it. This link https://github.com/google/closure-compiler/issues/2398 suggests the issue is somehow with the closure compiler - can anyone maybe shed some more light on this?

āœ… 1
thheller 2020-09-15T09:38:57.490400Z

@d.eltzner012 its a polyfill issue. what is your setup? I'm presuming shadow-cljs? which :target? which version?

Elso 2020-09-15T09:41:08.491400Z

yes - :target is :browser and version was 2.11.1, but I'm currently rerunning it with 2.11.4 to see if that suffices

thheller 2020-09-15T09:42:12.492400Z

if you want to get rid of it completely you can just set :compiler-options {:output-feature-set :es6} (or :es7, :es8). depending on which older browsers you want to support

Elso 2020-09-15T09:43:34.493600Z

Okay, first version bumping shadow 'solved' it again, so thanks. Second, and sorry for my ignorance here, but I don't really see the connection - so I guess by default the output feature-set is by default set to something lower than es5 and that tends to be problematic somehow?

Elso 2020-09-15T09:43:44.494Z

*es6

thheller 2020-09-15T09:43:49.494300Z

would help to have a reproducible case. I've been trying to fix this for a while now but can't quite figure out how it gets into a bad state šŸ˜ž

thheller 2020-09-15T09:44:37.494400Z

the default is :es5 which means if there are npm packages that contain newer language features they are compiled down and polyfills are added

thheller 2020-09-15T09:44:53.494600Z

$jscomp is those polyfills but sometimes they don't get added correctly for some reason

Elso 2020-09-15T09:45:29.494800Z

I'd love to help but I obviously don't understand the circumstances either - I'm also quite the noob in JS-land so too much confusion here

thheller 2020-09-15T09:45:33.495Z

$jscomp.inherits is used for class Foo extends Bar polyfilling I believe

thheller 2020-09-15T09:46:06.495300Z

so :es6 might be fine and that works in 98% of all browsers anyways

Elso 2020-09-15T09:46:13.495500Z

I see

Elso 2020-09-15T09:48:29.495700Z

I guess I'll go with es6 then. thanks again!

Elso 2020-09-15T09:48:44.495900Z

for your awesome stuff in general too obviously.

thheller 2020-09-15T09:48:55.496100Z

this might just be a bad cache for some reason. if it gets into that state again you can try deleting .shadow-cljs/builds/your-build and restarting the watch

šŸ‘ 1
Mitch 2020-09-15T22:38:07.497800Z

Regarding theĀ `infer-externs` compiler option: Are you intended to move the generated externs inĀ `inferred_externs.js`Ā to a file that you use for advanced compile? Or is it supposed to be enough to use type hinting andĀ `infer-externs`Ā when you use advanced compile?