Fork me on GitHub
#figwheel-main
<
2022-08-16
>
kah0ona18:08:50

Hi Folks, I’m updating all my deps in a project, and build the figwheel-main config etc. from scratch as to be up to date with the latest way of doing things… But I stumple upon this:

import { nlNL } from 'date-fns/locale'
how to require this in my code?. The deps for this are in package.json I use :target :bundle in my dev.cljs.edn are there any more things to be done? what is the idiomatic way?

kah0ona18:08:03

I see in my browser that ‘dateFns’ is available. But somehow getting into this submodule doesn’t work

kah0ona18:08:59

But for these kind of problems: in theory you only need to add it to package.json, and require it in your code right? And then use :target :bundle

athomasoriginal20:08:12

what do you get when you require it like this:

(:require
    [date-fns :as dfns])

(js/console.log dfns)
I'm not actually sure what the name of the library is, so you have to accommodate for that.

kah0ona20:08:20

yeah that one works, but i can’t seem to get the locale submodule

kah0ona20:08:43

import { nlNL } from 'date-fns/locale'
ie., the cljs equivalent of that. according to the docs it should exist

kah0ona20:08:19

now I wondered, in my old setup I had some extra file that webpack used to expose the above nlNL module, and put that on the global window object

kah0ona20:08:47

but I thought, that since I now use npm for everything, I could get rid of such a file an configurative overhead 🙂

athomasoriginal21:08:45

What's in the namespace? Depending on the package you can dig into it and see what's there. I'm not by the comp so I can't test.