This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-09
Channels
- # announcements (16)
- # babashka (28)
- # beginners (27)
- # calva (39)
- # chlorine-clover (6)
- # cider (8)
- # clara (28)
- # cljs-dev (19)
- # cljsrn (22)
- # clojure (78)
- # clojure-australia (3)
- # clojure-europe (64)
- # clojure-nl (3)
- # clojure-norway (14)
- # clojure-spec (2)
- # clojure-uk (11)
- # clojurescript (11)
- # core-async (24)
- # datomic (3)
- # deps-new (5)
- # emacs (9)
- # fulcro (4)
- # gis (2)
- # graalvm (9)
- # honeysql (2)
- # hoplon (5)
- # instaparse (1)
- # introduce-yourself (5)
- # jobs (5)
- # luminus (4)
- # observability (7)
- # off-topic (6)
- # pathom (18)
- # pedestal (5)
- # polylith (4)
- # re-frame (2)
- # reagent (1)
- # reitit (1)
- # remote-jobs (7)
- # shadow-cljs (47)
- # specter (1)
- # sql (27)
- # testing (6)
- # tools-deps (4)
- # vim (3)
- # xtdb (8)
Hello all: im struggling to figure out how/when shadow-cljs may or may not automatically invoke npm install
i have two projects and I cant spy a difference in their config, yet one will implicitly install npm deps and the other doesnt
$ lein dev
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
shadow-cljs - config: /Users/ghaskins/sandbox/git/mcp-login-ui/shadow-cljs.edn
shadow-cljs - running: lein run -m shadow.cljs.devtools.cli --npm watch app
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
running: npm install --no-save path@^0.12.7 chart.js@^2.9.4 react-chartjs-2@^2.11.1 react-sparklines@^1.7.0 react-password-strometer@^0.1.18 base64url@^3.0.1
I do not get that in the project that doesnt work…in that project, manually running npm install fixes it
as far as I know shadow never does this. There's a lein plugin that you are likely using here that does this. To me that plugin is a mistake, making everything more complicated
That’s what I was wondering (and I agree) but I don’t seem to have a plug-in in either
in the project.clj file you should see a shadow config, and also a lein-shadow (i think this is the name) plugin. This plugin allows you to keep the config in project.clj, the aim being that everything in a single file is beneficial. It installs npm deps, copies the shadow part to the standard shadow-cljs.edn location and then runs shadow for you. I see zero benefit and only downsides
i do use lein, but I have a distinct shadow-cljs.edn (with lein=true) and package.json for each
@ghaskins installing npm dependencies is handled by libraries containing a deps.cljs
file with :npm-deps
listed
otherwise you can disable it in shadow-cljs.edn
but thats about it. maybe the other project has older dependencies that didn't yet have deps.cljs
?
@dpsutton shadow does install npm deps by default (for now, might make it optional at some point)
huh. i could have sworn when i watch an project in the past it would fail until i killed it and npm installed the deps.
well it can only install npm deps if they are listed in deps.cljs
. many libs didn't do that for a while but nowadays most do
Hello, how do I do import 'leaflet/dist/leaflet.css';
from https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages I understand it should be (:require ["leaflet/dist/leaflet.css"])
? But think I'm doing something wrong
@zackteo css is not supported, so you need to handle it separately. might be enough to just copy the node_modules/leaflet/dist/leaflet.css
to your public folder and include it
really depends on what kind of css setup you have. if you don't have one then the manual copy is probably good enough. if you have something like postcss setup just use that.
> installing npm dependencies is handled by libraries containing a `deps.cljs` file with `:npm-deps` listed @thheller thats what I figured…what I cant reconcile atm is that both projects include the same cljs lib with a deps.edn, and then locally declare additional npm deps (such as react) in their local packages.json
but for reasons I am still unsure about, one project implicitly runs npm install and the other does not
i just wasnt sure if there was something to look for, like “oh, check :foo-bar in shadow-cljs.edn”
@ghaskins shadow never runs an inital npm install
for stuff listed in your package.json. that you have to do yourself
shadow will only install npm deps that aren't already listed in package.json, so if you have those in them but did not run npm install
then they won't be installed
basically the deps.cljs install is just a way to get missing things into your package.json
yeah…the project that isnt working had previously been run with the defaults that creates packages-lock