Fork me on GitHub
#shadow-cljs
<
2019-07-15
>
vinurs01:07:02

anyone use ant-design with shadow-cljs?

vinurs01:07:25

i use modularized antd and set .babelrc but it seems that the js and css file are not import modularly

thheller09:07:33

@haiyuan.vinurs what is modularized antd?

vinurs09:07:21

that is only import the js and css that used

thheller09:07:12

so you do (:require ["antd/es/date-picker" ...]) and so on?

Ahmed Hassan09:07:13

Would this also require css related to antd/es/date-picker?

thheller09:07:38

no. shadow-cljs does not support CSS

👍 4
Ahmed Hassan09:07:47

Is there a way for this in ClojureScript?

Ahmed Hassan09:07:00

Like import 'antd/es/date-picker/style/css';

thheller09:07:29

you can just use something like node-sass and import it there

vinurs14:07:16

sorry for late reply, so the best way is that i include the ant-design.min.css in my html file?

thheller09:07:26

the babel plugin won't do anything

alpox19:07:17

Hi all! I have a short question about the usage of shadow-cljs with electron. Everything works well until now except the usage of the fs module in the renderer process. From the main process it is no problem to (require '["fs" :as fs]) and get the fs module. But from the renderer process, all I get is an empty map: #js {} while for the modules path and url i get the right modules. I cannot figure out how this happens. Does anyone have an input to this?

thheller20:07:39

@alpox you are probably using the wrong build config. the renderer process should have :js-options {:js-provider :require}

alpox20:07:34

Hi @thheller many thanks for awesome shadow-cljs!

alpox20:07:56

Setting that option for the renderer process sadly led to a whole series of: Uncaught ReferenceError: require is not defined 😞

thheller20:07:54

hmm did they change that or did you disable it in the electron config?

thheller20:07:05

it used to be able to use require directly?

alpox20:07:40

I don't have an electron config so that should be the default. I have the feeling that I have some tooling problem with CIDER. I hope that it works with that option once I get around it!

alpox20:07:47

Ok I deleted .shadow-cljs and the errors vanished except that the behavior with the fs module is still the same with the :js-options {:js-provider :require} option

alpox20:07:57

Meaning I still get an empty map

thheller20:07:20

and what do you get if you do (js/require "fs")?

alpox20:07:40

This happens with and without the js-provider set to :require

alpox21:07:21

I tested now multiple times and the require is not defined errors always appear with :require set as js-provider, the fs problem occurs with and without

alpox21:07:54

I guess electron does something special to provide those node modules for the renderer

thheller21:07:28

just to be clear though this is a regular electron renderer window? not a normal browser?

thheller21:07:47

but yeah fs and such are typically only used in the main process

thheller21:07:06

require should definitely be available though

alpox21:07:48

Yes it is a regular electron renderer window from a newly setup project

thheller21:07:57

As of version 5, the default for nodeIntegration changed from true to false.

alpox21:07:44

Ohhh my. But they really should put a hint to that in their documentation where they say that node modules are available everywhere 😄

alpox21:07:50

I'll try that - thanks for the hint!

alpox21:07:30

Wonderful 🙂 @thheller so the error was somewhere totally different than I expected. Thanks for the fast help!