Fork me on GitHub
#shadow-cljs
<
2021-02-15
>
RollACaster11:02:42

Hi, I am trying to import http://kepler.gl, unfortunately the library is mixing esm & commonjs imports which results in an error when I try to import them. https://github.com/keplergl/kepler.gl/blob/master/src/localization/index.js#L30 I tried to manually specify the requirements with:

{
  ...
   :js-options
   {:resolve {"./fi" {:target :file
                      :require  "node_modules/kepler.gl/dist/localization/fi.js"}}
             ...}
}
Which resulted in another error: $jscomp.inherits is not a function Is there some way to import this library?

thheller12:02:57

@thsojka you might need to use webpack. the lib seems to do stuff that shadow-cljs does not support

thheller12:02:16

the inherits you can get rid of by setting :compiler-options {:output-feature-set :es6}

RollACaster12:02:04

thanks 👍 I’ll try that

zendevil13:02:12

something that’s working in regular react native isn’t working in cljsrn run with shadowcljs, making me think that there must be something up with shadow that’s causing it. React Native:

<LottieView
      source={require('../components/img/animations/cat-loading.json')}
      style={{marginRight: 100, marginLeft: 50}}
      autoPlay
      loop
    />
In this case I’m seeing the LottieView animation. Cljs React Native:
[:> LottieView {:source (js/require "../resources/images/loading2.json")
                      :autoPlay true
                      :loop true
                      :style {:height 200
                              :marginright 200
                              :marginleft 50}}]
In this case I’m not seeing the LottieView animation. What might be causing this error?

zendevil13:02:28

In the github of lottie files it’s imported like so:

import LottieView from 'lottie-react-native';

zendevil13:02:15

which, according to the shadow user guide translates to: [“lottie-react-native” :default LottieView]

zendevil13:02:08

But this gives an error. using :as instead of default doesn’t give an error (but the animation doesn’t show either). Why am I getting an error when using :default when I’m using the direct translation from shadow cljs user guide?

thheller14:02:09

@ps I don't have a clue. I do not use react-native. this looks correct to me except maybe for the path used in the js/require call. that looks wrong. might also be the :style map. not exaclty sure how reagent converts that, if at all.