This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-07
Channels
- # announcements (10)
- # babashka (11)
- # beginners (69)
- # calva (1)
- # cider (2)
- # clj-kondo (35)
- # cljdoc (48)
- # cljs-dev (3)
- # clojure (60)
- # clojurescript (10)
- # community-development (6)
- # cursive (4)
- # datahike (1)
- # datalog (33)
- # deps-new (2)
- # depstar (8)
- # docker (24)
- # fulcro (1)
- # graphql (4)
- # honeysql (5)
- # java (2)
- # leiningen (2)
- # missionary (3)
- # off-topic (104)
- # pedestal (8)
- # polylith (18)
- # portkey (3)
- # reagent (7)
- # reveal (1)
- # rewrite-clj (4)
- # shadow-cljs (19)
- # specter (3)
- # tools-deps (2)
I may have hit a bug in shadow-cljs, but not sure. When I require a node module ["fs" :as fs]
from two different namespaces, say nbb.main
and nbb.core
, I get
ReferenceError: import$fs is not defined
at C8 (file:///Users/borkdude/git/nbb/out/nbb_main.js:8:313)
after advanced compilation.
After this workaround, I got it working again:
https://github.com/borkdude/nbb/commit/df0edd3c2a560ea3954dc6943a228c3d49668e75looked into it a bit and figured out what is happening. will see if I can fix it soon
ok, it's not blocking me currently as I have a workaround, but I'm glad you found the issue
should be fixed in 2.15.3. I also added :compiler-options {:js-provider :import}
so you don't have to list every single package in :keep-as-import
, it'll just import everything
The required JS dependency "fs" is not available, it was required by "nbb/core.cljs".
When I put :js-options {:js-provider :import}
directly on the toplevel of the build, then I get a different error msg:
The required namespace "react" is not available, it was required by "reagent/core.cljs".
I also tried that one and got me a different error about react. I’ll try again when I’m at the computer
anybody familiar with how (whether?) shadow-cljs caches macro output? I have a cljs file -- let's say myns.cljs -- which includes a macro defined in myns.clj. The clj file slurps a file and feeds it into cljs. When I change the slurped file, the cljs file does not get updated during watch. When I touch
the clj file, then it does get updated. This is understandable. But I'm observing what looks like cached macro output when running release
. What's the easiest way to force re-running all macros?
I have not yet played with :cache-blockers
so I don't know if it's the same thing, but as a quick and dirty solution, it appears that rm -rf .shadow-cljs
does cause a refresh. Since this works reliably in a toy example based off of shadow-cljs/quickstart-browser.git most likely my pipeline was messed up
Subject: Use npm package with ES6 Syntax in shadow-cljs Hi everyone, I hope you all are doing great. I am very new to Clojure World. I am working on a ClojureScript, shadow-cljs project. I am trying to use an npm package in the project.I installed it using "yarn add react-native-swipe-list-view". On building it is showing Syntax Error: "Cannot use Import Statement outside a module" According to my research shadow-cljs implements a custom JS bundler and bundles node_modules into something that can be used with clojurescript. But that npm package uses ES6 Syntax and shadow-cljs having trouble bundling with that. I think I need to use babel to convert that into browser-friendly code first. I just need to figure out how to use babel to do that. It will be a big help if someone can point me to a resource to fix this issue. I posted other Info's like screenshots on this URL: https://github.com/status-im/status-react/pull/12432#issuecomment-894633595
shadow-cljs cannot bundle react-native stuff in general. it needs to go through metro or other react-native tools. building it directly is not supported.
FWIW the problem here has nothing to do with shadow-cljs. you are using the :node-test
target, which means that all JS requires are resolved by node. so your (:require ["react-native-swipe-list-view" :as swipe-list-view])
is just directly converted to a require("react-native-swipe-list-view")
with no further processing by shadow-cljs for this
the error you get is then from node, since the file you required that way does an import
@U05224H0W
Thank you very much for your reply. You were right, problem was with :node-test
. I was missing mock for package for testing and that's why it was crashing.