Fork me on GitHub
#shadow-cljs
<
2021-04-20
>
andre08:04:10

hi, does anyone know how to enable js/performance for :target :node-test ?

thheller08:04:59

no such thing in node. it is a module there. see https://nodejs.org/api/perf_hooks.html

andre08:04:55

how can i use this module ?

thheller08:04:17

as you use any other module (:require ["perf_hooks" :refer (performance)]) or so

andre08:04:56

oh ok thanks

thheller09:04:00

or require that somewhere else and make it a global so js/performance works

thheller09:04:22

I think the API is the same

andre09:04:06

many thanks!

ghaskins15:04:14

Hi all, does anyone have experience with the “@date-io/date-fns” npm package?

ghaskins15:04:43

im struggling with the import, trying everything I know but they are all returning nil

ghaskins15:04:00

e.g.

(require '["@date-io/date-fns" :as DateFnsUtils])
=> nil
DateFnsUtils
=> nil

ghaskins15:04:34

Im not always clear when various options are eligible to try, but I can typically get it to work by following https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages

ghaskins15:04:44

but this one is stubborn

thheller15:04:24

I don't know that library. might help to try node and the var x = require("@date-io/date-fns") x just to see what that would be

thheller15:04:36

might just be an error during load or something? did you check the console?

ghaskins15:04:13

let me try that

ghaskins15:04:52

nothing on the console, node returns

ghaskins15:04:53

> var x = require("@date-io/date-fns")
undefined
> x
[Function: DateFnsUtils]

thheller15:04:14

> (require '["@date-io/date-fns" :as DateFnsUtils])
nil
cljs.user=> DateFnsUtils
#object[Function]
cljs.user=>

thheller15:04:20

seems to work fine for me?

ghaskins15:04:21

unfortunately all 4 options are part of the same @date-io package so I suffer the same fate with all

ghaskins15:04:29

interesting

ghaskins15:04:37

i wonder why its not working here

ghaskins15:04:57

what version of @date-io did you use?

ghaskins15:04:22

im using “@date-io/date-fns” “1.3.13"

ghaskins15:04:56

(the material/picker said it was dependent on v1.x so maybe they updated in v2

thheller15:04:49

it installed these for me

"@date-io/date-fns": "^2.10.8",
    "date-fns": "^2.21.1",

ghaskins15:04:07

ok, ill see if I can level set with v2

Aron16:04:10

date-fns v2 > v1

ghaskins16:04:45

yes, the dep I am using explictly states to use @1.x

Aron16:04:53

every function should be independently requirable

ghaskins16:04:53

but, thanks

ghaskins16:04:39

it might just be too old

Aron16:04:07

I see, I am not sure why it wouldn't work, but I remember having some issues similar to yours. Sadly I don't remember how I resolved it, I might've just looked for a different dependency at the time. Imho there should be no reason why the old one wouldn't work.

ghaskins16:04:26

I know, its confounding

ghaskins16:04:31

ill keep plugging