Fork me on GitHub
#shadow-cljs
<
2022-04-09
>
pinkfrog00:04:25

What’s the recommended way for default import? I remember previously there is a sync

(require [xxx :default foobar])
but looking at the manual again, it now becomes
(require ["xxx$default" :as foobar])

thheller05:04:37

$default is the recommended. :default was a shadow-cljs only addition that was not compatible with regular CLJS. the $default also works in regular CLJS

pinkfrog00:04:53

Is the following foo and foo2 the same?

(ns app.style
  (:require
   ["twrnc" :rename {default foo}]
   ["twrnc$default" :as foo2]))
I tested they are the same, but not sure under what circumstance they will become different.

thheller05:04:32

they are the same yes

pinkfrog13:04:19

How shall I import this package? The runtime is react native. My code is

(ns app.style
  (:require
   ["twrnc" :as twrnc]
   ["twrnc$default" :as tw]))
Either twrnc or tw is nil.

pinkfrog13:04:01

Turns out the package app.style is not imported by other namespaces. And in turn, it is now bundled by metro.