Fork me on GitHub
#shadow-cljs
<
2023-03-26
>
frozenlock12:03:23

Continuing my migration from lein-figwheel. shadow-cljs watch app warns me about "WARNING: shadow-cljs not installed in project." However it looks like it still continues, so I'm not sure why I should install it in the project...? (The doc link associated with this warning appears to be broken)

frozenlock12:03:42

I also have some dependency issues. > The required JS dependency "moment" is not available, it was required by "cljsjs/moment.cljs". I looked into shadow-cljsjs and moment appears to be defined in it. Am I doing something wrong? react worked, so I'm a little confused as to why it fails with moment

frozenlock12:03:22

npm install moment downloads the dependency, but I dislike the manual step 😢

frozenlock12:03:02

Hmmm It says that the dependency codemirror.addon.display.autorefresh is not available, but I required it: ["codemirror.addon.display.autorefresh"]

frozenlock12:03:16

(those addons come with codemirror, which I already installed)

thheller13:03:34

that is not an npm package. that is a pseudo namespace for that cljsjs lib

thheller13:03:51

likely just ["codemirror/addon/display/autorefresh"] instead

👍 1
thheller13:03:02

> WARNING: shadow-cljs not installed in project

thheller13:03:25

it should be installed via npm install shadow-cljs. it provides a couple other dependencies you might need when working with shadow-cljs

thheller13:03:40

in general just get used to managing your dependencies in package.json

thheller13:03:55

you only do npm install moment once, after that is in package.json

thheller13:03:11

later if you want to install all packages listen in package.json you just npm ci for clean install

thheller13:03:28

or npm install also works, doesn't really matter

frozenlock13:03:30

error in process sentinel: Could not start nREPL server: Error loading shadow.cljs.devtools.server.nrepl: Unexpected error macroexpanding if-ns at (cider/piggieback.clj:22:1).
Syntax error compiling var at (/tmp/form-init3679489719716306863.clj:1:16584).
Unable to resolve var: shadow.cljs.devtools.server.nrepl/middleware in this context
(╯°□°)╯︵ ┻━┻

frozenlock14:03:42

Looks like this is caused by :nrepl-middleware [shadow.cljs.devtools.server.nrepl/middleware]

thheller14:03:43

no, this is caused by a dependency conflict

thheller14:03:01

likely piggieback dep

thheller14:03:43

or a super ancient shadow-cljs version

thheller14:03:52

get the full error including stacktrace to know for sure

Ben Lieberman16:03:21

Is it correct that shadow does not support importing CSS into JS files even when using an external provider? I used webpack and their styles loader, can interact with JS imports, but when I try import 'style.css' the build fails.

thheller16:03:39

what do you mean by import 'style.css'?

thheller16:03:05

css is supported with :js-provider :external, although still not recommended via ns :require

Ben Lieberman16:03:37

If i import a stylesheet into a JS file, and then include that directory in my shadow build, the compilation fails and says "cannot identify as CLJS resource"

thheller16:03:54

you gotta be more specific 😛

thheller16:03:07

which JS file are you talking about here?

thheller16:03:32

if its a JS file that is processed by shadow-cljs that it cannot require CSS files

thheller16:03:40

CLJS files can

thheller16:03:05

remember webpack can process css files, shadow-cljs cannot 😛

Ben Lieberman17:03:21

That's what I mean yeah, a JS file processed by shadow

thheller17:03:21

yeah, they can't require css files