Fork me on GitHub
#shadow-cljs
<
2021-12-11
>
deas16:12:22

Hi! Is there a way to make shadow-cljs emit the equivalent of export default function(data) { /* */} for target :node-library?

jcoyle19:12:49

Hi! Does anyone know if there is a top-level config for controlling the log-level (meaning logs from shadow-cljs) in the browser console? For example in Figwheel there is :client-log-level which can be set to: :severe `:warning` `:info` `:config` `:fine` `:finer` `:finest` . I would like to temporarily disable “info” level warnings such as “shadow-cljs: call app.core/start” that come from shadow.

thheller19:12:17

@deas just :exports {:default some.ns/foo} where foo is a regular defn. assuming commonjs is ok, otherwise you need to go with :target :esm

thheller19:12:06

@jcoyle :devtools {:log false} in your build config

jcoyle19:12:45

@thheller thank you very much!

deas20:12:05

@thheller Need ESM (https://k6.io/docs/using-k6/http-requests/). Not quite there, but I guess you brought me a lot closer. Thanks!

deas08:12:19

@thheller Turned out there is no selfor navigatorproperty in k6. I Guess that rules out :esmfor the moment? However, on the positive side of things, I got it working as :node-librarybuild hack.js

import hack from "./dist/hack.js";

export default hack.default$;

thheller08:12:08

I don't know what you mean by "Turned out there is no selfor navigatorproperty in k6"

thheller08:12:32

nothing in shadow-cljs uses those so it must be your code or code you are using

thheller08:12:28

I don't know a single thing about k6 so I can't really comment much on what you need or what works

deas09:12:38

The code emitted using :target :esmrefers to selfand window.navigator. Guess it is the Closure Compiler introducing them. Both exist in the browser and also in deno. Don't see a way to polyfill them atm.

thheller09:12:28

ah I guess you are talking aout dev builds? so watch/compile, yeah those might reference those. release however should not

deas09:12:42

No, the releasebuilds have these references.

deas09:12:50

If you have a quick idea how to get rid of them or polyfill, it would be nice if you could let me know. ;)

thheller09:12:09

self is probably from goog/base.js so thats not easily replaced. the navigator I don't know

thheller09:12:47

but if your hack is working then use that for now

👍 1
thheller09:12:22

don't have time currently to look into what runtime k6 uses

deas09:12:26

All good. Completely understand you may have other things to do. 😉