This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-24
Channels
- # aleph (5)
- # announcements (18)
- # babashka (3)
- # babashka-sci-dev (56)
- # beginners (56)
- # biff (5)
- # calva (27)
- # cider (20)
- # clj-commons (2)
- # clj-kondo (17)
- # cljsrn (18)
- # clojure (41)
- # clojure-europe (24)
- # clojure-nl (1)
- # clojure-serbia (1)
- # clojure-uk (15)
- # clojured (1)
- # clojurescript (40)
- # cursive (39)
- # datahike (2)
- # datalevin (4)
- # datascript (5)
- # emacs (23)
- # events (2)
- # figwheel-main (3)
- # inf-clojure (1)
- # instaparse (23)
- # introduce-yourself (3)
- # jobs (3)
- # jobs-discuss (13)
- # joyride (1)
- # juxt (10)
- # malli (21)
- # nbb (29)
- # off-topic (18)
- # pathom (29)
- # polylith (11)
- # project-updates (1)
- # proletarian (1)
- # rdf (2)
- # re-frame (4)
- # reitit (2)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (52)
- # tools-deps (57)
- # xtdb (32)
Has anyone here had any luck requiring .js
or .jsx
files from Krell? I cannot figure out what path the bundler wants me to give it.
The Juxt blog post here shows a directory structure: https://www.juxt.pro/blog/clojurescript-native-apps-2021
But reproducing what they’re describing doesn’t seem to work for me; no matter where I put the file or reference it, I see errors from the bundler (i.e., the output of yarn start
) like:
ERROR Could not evaluate [TypeError: undefined is not an object (evaluating 'require("../src/file_for_later/ios/js/Test.jsx").default')]
I’ve essentially spammed every combo I can think of, with no luck.
I can start a blank project for a bare repro, but if someone here has been through this and can give me the secret before I try, happy to listen to ideas.
JS dependencies need to be processed via metro which can't be done at the REPL. so JS deps in general are only available via a regular build
otherwise it should be a path relative to the output file of your CLJS. unless krell rewrites that in some way. not sure about that part.
Did it by changing and saving the file, then doing a reload from the simulator, which generated a new error with a different path from metro, so I’m pretty sure the changes are being picked up.
Relative to CLJS is what I tried first. The Juxt blog seems to imply it’s not that:
// src/app/components.cljs
(def utils (js/require "../src/stories/utils.js"))
I’ve confirmed in the output JS in target/
generated from my CLJS that the relative path refers to the place my JS file lives.
I’m wondering if I’m doing something wrong in writing the JS itself? I.e., the require(...)
is returning undefined
, so maybe it finds the file but doesn’t actually get anything out of it?
Having the same issue with assets (i.e., a png file), so I don’t think the issue is the JS.
It does appear to be recompiling (i.e., the output JS in target/
changes)
I’m not sure what you mean about paths in deps.edn, so maybe I’m missing that?