cljsrn

dnolen 2021-09-08T12:29:21.162Z

@soxley you don't need to use js/require

dnolen 2021-09-08T12:29:40.162500Z

Krell is designed to just leverage Metro and node_modules through ClojureScript support for bundlers

dnolen 2021-09-08T12:30:01.163Z

Whatever the docs are for StorybookUIRoot you should be able to replicate it in ClojureScript

dnolen 2021-09-08T12:33:03.164400Z

that said there may be peculiarities about Storybook here that I don't understand - I've never actually tried to do this myself

soxley 2021-09-08T13:54:32.168600Z

Yeah, so the tutorial I’m following here: https://storybook.js.org/tutorials/intro-to-storybook/react-native/en/get-started/ says to import StorybookUIRoot from ‘../storybook’ (excuse the quotes, I’m on my phone), so that’s what I’m trying to replicate. I thought js/require would be the way to do that. I’ve looked for other docs about how to do that generally in ClojureScript but I haven’t had much luck.

dnolen 2021-09-08T14:28:26.169Z

@soxley https://clojurescript.org/guides/webpack this may look like it's specific to webpack but it is not

dnolen 2021-09-08T14:28:53.169400Z

it's worth going over and shows how to import something from node_modules

dnolen 2021-09-08T14:29:24.170Z

Krell just reuses the bundler stuff so it's not any different

soxley 2021-09-08T18:54:53.171800Z

Ok, that looks promising. I’ll take a look

soxley 2021-09-08T00:23:03.161100Z

I’m trying to get storybook working with a react-native app that I have set up with Krell. I have storybook up and running and I have the app up and running, but I think what I need to do next is add StorybookUIRoot into my app, but I’m not sure how to do that. My main problem is I don’t know how to import a JavaScript module from my Clojurescript code. I’m trying js/require but it doesn’t seem to work the way I expect.

soxley 2021-09-08T00:24:30.161200Z

There’s a storybook directory in the root of my project, and this is the code for my app:

(ns react-native-client.core
  (:require [reagent.core :as r]
            [reagent.react-native :as rn]))

(def StorybookUIRoot (js/require "../../storybook"))

(defn hello []
  [rn/view {:style {:flex 1 :align-items "center" :justify-content "center"}}
   [rn/text {:style {:font-size 30}} "Hello Lift Buddy!"]])



(defn ^:export -main [& args]
  (r/as-element [StorybookUIRoot]))

soxley 2021-09-08T00:25:10.161400Z

That yields an error Error: Assert failed: Invalid Hiccup form: [nil]

soxley 2021-09-08T00:25:35.161600Z

Which I assume means that StorybookUIRoot is nil and my js/require isn’t working.