This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-10
Channels
- # announcements (6)
- # architecture (2)
- # babashka (30)
- # beginners (90)
- # calva (21)
- # cider (22)
- # clj-kondo (27)
- # cljs-dev (7)
- # clojure (132)
- # clojure-europe (51)
- # clojure-nl (12)
- # clojure-norway (3)
- # clojure-spec (3)
- # clojure-uk (5)
- # clojurescript (69)
- # cloverage (9)
- # conjure (5)
- # core-async (54)
- # cursive (14)
- # datomic (34)
- # emacs (7)
- # fulcro (10)
- # graalvm (40)
- # graalvm-mobile (2)
- # gratitude (2)
- # improve-getting-started (1)
- # introduce-yourself (1)
- # jobs-discuss (61)
- # leiningen (5)
- # malli (6)
- # off-topic (59)
- # pathom (11)
- # polylith (38)
- # reagent (3)
- # reitit (3)
- # rewrite-clj (3)
- # shadow-cljs (53)
- # tools-build (35)
- # transit (8)
- # vim (62)
- # web-security (26)
- # xtdb (4)
I am trying to use instaparse in a shadow-cljs project. I have the following in shadow-cljs.edn: :dependencies [[instaparse "1.4.10"]] The instaparse-1.4.10.jar is present in the appropriate .m2 repository. But shadow-cljs is not finding it. What am I doing wrong?
it is not. cider-jack-in-clj&cljs
attempts to use the same process to start two separate repls. This was possible with figwheel. Shadow is a separate process so you cannot start a single lein
and then create two repls from it, one clj and one cljs
hello, I'm relatively new to ClojureScript and I'm trying to set up tests for a ns that has a couple of functions. I'm using the recommended cljs.test
setup from https://clojurescript.org/tools/testing and I can run my tests fine from the REPL using cljs.test/run-tests
. I also followed the instructions in https://shadow-cljs.github.io/docs/UsersGuide.html#target-node-test but when I run shadow-cljs compile test
on my terminal I get this exception:
shadow-cljs - connected to server
[:test] Compiling ...
NullPointerException:
shadow.build.node/configure (node.clj:59)
shadow.build.node/configure (node.clj:45)
shadow.build.targets.node-script/configure (node_script.clj:37)
The article at https://code.thheller.com/blog/shadow-cljs/2017/10/14/bootstrap-support.html links to https://github.com/mhuebert/shadow-bootstrap-example for a standalone example.
But building the :bootstrap
build with shadow-cljs 2.17.0 (where originally it was 2.11.7) fails with:
------ ERROR -------------------------------------------------------------------
File: jar:file:/home/p-himik/.m2/repository/org/clojure/clojurescript/1.10.914/clojurescript-1.10.914.jar!/cljs/js.cljs:9:1
--------------------------------------------------------------------------------
6 | ; the terms of this license.
7 | ; You must not remove this notice, or any other, from this software.
8 |
9 | (ns cljs.js
-------^------------------------------------------------------------------------
null
The alias env is already used for namespace cljs.env.macros
--------------------------------------------------------------------------------
10 | (:refer-clojure :exclude [require eval])
11 | (:require-macros [cljs.js :refer [dump-core]]
12 | [cljs.env.macros :as env])
13 | (:require [clojure.string :as string]
--------------------------------------------------------------------------------
Presumably because cljs/js.cljs
has both [cljs.env.macros :as env]
in its :require-macros
and [cljs.env :as env]
in its :require
.
Is there a way to fix this?Thanks for verifying the bug. I was chasing the same issue earlier.
hmm my check seems to be doing exactly what it is supposed to be doing? how is this ns form valid? it has env
as alias for two different namespaces 😛
Thank you.
Hi, any tips to debug this error?
shadow-cljs: reloading code but no :after-load hooks are configured!
I do have the :after-load
hook configured, and I can evaluate the function of the hook, but somehow nothing happens when I save a file. It's a :browser target, but with an Electron host
where do you have :after-load
configured? it is much easier to have ^:dev/after-load
in the metadata of your code
code that needs to be included in the build naturally. so if you put it in some namespace that is not part of the build it won't trigger
I have in both metadata and in :devtools
option. None worked
This is the config:
{:target :browser
:output-dir "static"
:asset-path "."
:modules {:main {:init-fn cljs.atom.view/start!}}
:js-options {
:keep-native-requires true}
;:js-provider :require}
:devtools {:before-load cljs.atom.view/start
:after-load cljs.atom.view/after-load}}
cljs.atom.view
is in the config, and when I save the file, I see on Electron's console:
shadow-cljs: reloading code but no :after-load hooks are configured!
browser.cljs:20 shadow-cljs: load JS cljs/atom/view.cljs
Both hooks point only to a (println "testing")
for now...
Aaaahhhh, ok!
Yep, that was it! Thanks again, as always! I'm doing something incredibly bizarre with ClojureScript, so I though it was something way more complicated than just the namespace name 😄
How do you deal with other watchers, doing some work outside of shadow-cljs?
For example, I'm using postcss, and I have an npm script task to compile/watch. I can run it in another shell session, not a problem. But that has a minor annoyance - whenever I make style-related changes, they do not reflect in the browser without a manual refresh. And I think what's happening is that shadow-cljs picks up changes first (when .cljs files with hiccup modified), and npm script process always lagging behind.
I thought about maybe using ^:dev/before-load-async
, but that's in a file on the browser side. Can I have something similar but in clj, not cljs?
although I only use it to run postcss itself. I run shadow-cljs separately but you could easily run it there too
as for style related changes I added a new hook for that recently that is not in the docs yet
https://github.com/thheller/shadow-cljs/commit/e9093aed586d5fb49efd94555787f0bef08fb164
you may just be missing some watch related config if you just have css that isn't getting reloaded in the first place yet
@U05224H0W Hello Tomas, it works not only for css files, right? (I try to reload frontend after changes in .edn
resources)
@U05224H0W But why? It's not possible in current implementation or needless feature or no time to implement this functionality?
mostly because there are limits to what shadow-cljs can reasonably do. There is no easy way to tell which files you are going to access and tracking all of them might get expensive. dunno what you are doing this code .edn
files but maybe this already solves whatever it is https://clojureverse.org/t/using-none-code-resources-in-cljs-builds/3745
@U05224H0W Thanks for the answer. I use .edn
files for translations (i18n) that's why I wanna reload frontend after some changes in them. I think it's a popular case. Isn't it?
So you haven't any plans to extend this tracking?