figwheel-main

Marten Sytema 2022-08-16T18:41:50.140949Z

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?

Marten Sytema 2022-08-16T18:43:03.978379Z

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

Marten Sytema 2022-08-16T18:43:59.276519Z

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

athomasoriginal 2022-08-16T20:13:12.454949Z

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.

Marten Sytema 2022-08-16T20:27:20.453269Z

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

Marten Sytema 2022-08-16T20:27:43.439349Z

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

Marten Sytema 2022-08-16T20:28:19.269189Z

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

Marten Sytema 2022-08-16T20:28:47.959499Z

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

athomasoriginal 2022-08-16T21:09:45.287069Z

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.