This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-11
Channels
- # announcements (6)
- # babashka (7)
- # beginners (145)
- # biff (2)
- # calva (9)
- # cider (4)
- # circleci (9)
- # clj-commons (22)
- # clj-kondo (26)
- # cljs-dev (70)
- # cljsrn (4)
- # clojure (46)
- # clojure-australia (9)
- # clojure-europe (62)
- # clojure-nl (5)
- # clojure-norway (4)
- # clojure-spec (11)
- # clojure-uk (3)
- # clojurescript (18)
- # copenhagen-clojurians (1)
- # core-async (1)
- # cursive (13)
- # datahike (6)
- # datomic (47)
- # emacs (5)
- # events (2)
- # fulcro (13)
- # google-cloud (2)
- # gratitude (2)
- # helix (5)
- # honeysql (5)
- # hyperfiddle (31)
- # jobs (1)
- # jobs-discuss (6)
- # london-clojurians (1)
- # lsp (5)
- # off-topic (9)
- # polylith (12)
- # portal (18)
- # re-frame (5)
- # reagent (29)
- # releases (2)
- # shadow-cljs (43)
- # specter (1)
- # test-check (8)
- # vim (1)
- # xtdb (66)
Is there some kind of clean step or way to force recompiling the classpath (like -Sforce
for tools.deps) in shadow-cljs? I didn't see one in the docs. I ask because I'm sometimes compiling my code in a docker container and sometimes locally. I end up getting errors like this when compiling in the container:
> $ yarn shadow-cljs release main
> ...
> shadow-cljs - starting via "clojure"
> Error: Could not find or load main class clojure.main
> Caused by: java.lang.ClassNotFoundException: clojure.main
> error Command failed with exit code 1.
Deleting the .cpcache
directory fixes it, but I'm wondering if there is other stuff I should be deleting.
@bmaddy you can just use the clojure/clj commands directly. shadow-cljs release app
is identical to clj <aliases+whatever> -M -m shadow.cljs.devtools.cli release app
I'm trying to use the npm module fast-glob
, but am failing to import it properly. Trying this:
(:require ["fast-glob" :as fast-glob :default fg :refer [sync]] ...)
I get module$node_modules$fast_glob$out$index is not defined
whichever of those symbols (`fast-glob`, fg
, sync
) I try to evaluate, and also if I try to call any of them. I do see that this file has been produced:
out/js/cljs-runtime/module$node_modules$fast_glob$out$index.js
I've tried restarting the watcher, and even wiped .shadow-cljs/
and out/
to no avail.Ideally I want to use the Async API of fast-glob: https://github.com/mrmlnc/fast-glob#asynchronous
const fg = require('fast-glob');
const entries = await fg(['.editorconfig', '**/index.js'], { dot: true });
// ['.editorconfig', 'services/index.js']
But that's a luxury problem right now. 😃Oh, sorry, forgot. It's an electron project, #joyride to be precise. My config looks like so:
{:deps true
:builds
{:extension {:target :node-library
:js-options {:js-provider :shadow
:keep-native-requires true
:keep-as-require #{"vscode"}}
:compiler-options {:infer-externs :auto}
:output-dir "out/js"
:output-to "out/joyride.js"
:exports {:activate joyride.extension/activate}
:devtools {:before-load-async joyride.extension/before
:after-load joyride.extension/after}}}}
can't look into why it doesn't work right now. but node only packages pretty commonly do node specific stuff that shadow-cljs doesn't support.
Running into troubles with the packaged extension now instead, @thheller:
mainThreadExtensionService.ts:111 Activating extension 'betterthantomorrow.joyride' failed: Cannot find module 'fast-glob'
Require stack:
- /Users/pez/.vscode/extensions/betterthantomorrow.joyride-0.0.9-52-get-started-content-6099ecbf/out/joyride.js
- /Users/pez/.vscode/extensions/betterthantomorrow.joyride-0.0.9-52-get-started-content-6099ecbf/extension.js
- /Applications/Visual Studio
- /Applications/Visual Studio
- /Applications/Visual Studio .
$onExtensionActivationError @ mainThreadExtensionService.ts:111
Is there a way I can make shadow bundle it into the release build?I got around this by using fdir
instead of fast-glob
. That one doesn't need to be included in the :keep-as-require
set.
fast-glob would need to be bundled. I assumed that would be handled in some way already by electron.
With Calva we use webpack to bundle things together. We might need to go there with #joyride too. But for now shadow does all the work.
Electron is maybe the wrong way to describe the project. It's a VS Code extension, and VS Code is Electron.
yeah, just would assume that the default tooling for this would include npm packages in some way
Checking understanding. shadow-cljs supports:
["semantic-ui-react$Confirm" :as Confirm]
It does not support:
[semantic-ui-react$Confirm :as Confirm]
Huh. Sorry, I slipped up somewhere. It now indeed works, as one presumes it did all along!
Ok, got it broken again for me. This branch passes: https://github.com/danieroux/semantic-ui-wrapper/tree/cljs
[:workspaces] Build completed. (1105 files, 0 compiled, 0 warnings, 14.66s)
This one does not: https://github.com/danieroux/semantic-ui-wrapper/tree/shadow-cljs-build-issues
[:workspaces] Build failure:
Multiple files failed to compile.
aborted par-compile, [:shadow.build.classpath/resource "fulcrologic/semantic_ui/workspaces/dropdown.cljs"] still waiting for #{com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown-item com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown-divider com.fulcrologic.semantic-ui.elements.icon.ui-icon com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown-menu}
{:aborted [:shadow.build.classpath/resource "fulcrologic/semantic_ui/workspaces/dropdown.cljs"], :pending #{com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown-item com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown-divider com.fulcrologic.semantic-ui.elements.icon.ui-icon com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown-menu}}
ExceptionInfo: aborted par-compile, [:shadow.build.classpath/resource "fulcrologic/semantic_ui/workspaces/dropdown.cljs"] still waiting for #{com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown-item com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown-divider com.fulcrologic.semantic-ui.elements.icon.ui-icon com.fulcrologic.semantic-ui.modules.dropdown.ui-dropdown-menu}
well the string is absolutely preferred yes. can't say why it fails, will try with a smaller example 😉
I'm getting errors when starting npx shadow-cljs server
[2022-05-11 14:22:58.929 - WARNING] :shadow.cljs.devtools.server.nrepl/middleware-fail - {:sym cider.nrepl/cider-middleware}
Note: The following stack trace applies to the reader or compiler, your code was not executed.
CompilerException Syntax error compiling at (cider/nrepl.clj:1:1). #:clojure.error{:phase :compile-syntax-check, :line 1, :column 1, :source "cider/nrepl.clj"}
I didn't think cider was built in. But there it is. I'll put my shadow-cljs config in the thread.
My shadow-cljs.edn:
{:builds
{:app {:asset-path "/js"
:modules {:main {:init-fn app.core/main}}
:output-dir "public/js"
:target :browser}
:cards {:asset-path "/js"
:modules {:main {:init-fn app.cards/main}}
:compiler-options {:devcards true}
:output-dir "public/js"
:target :browser}
:test {:ns-regexp "app.cards"
:output-to "out/test.js"
:target :node-test}
:e2e {:ns-regexp "e2e.*"
:output-to "out/e2e.js"
:target :node-test}}
:dependencies [[reagent "0.8.1"]
[devcards "0.2.6"]
[cljs-http "0.1.46"]
; [cider/cider-nrepl "0.28.3"]
]
:dev-http {3000 "public"}
:nrepl {:port 3333}
:source-paths ["src"]}
[2022-05-11 14:22:58.929 - WARNING] :shadow.cljs.devtools.server.nrepl/middleware-fail - {:sym cider.nrepl/cider-middleware}
Note: The following stack trace applies to the reader or compiler, your code was not executed.
CompilerException Syntax error compiling at (cider/nrepl.clj:1:1). #:clojure.error{:phase :compile-syntax-check, :line 1, :column 1, :source "cider/nrepl.clj"}
clojure.lang.Compiler.load (Compiler.java:7648)
clojure.lang.RT.loadResourceScript (RT.java:381)
clojure.lang.RT.loadResourceScript (RT.java:372)
clojure.lang.RT.load (RT.java:459)
clojure.lang.RT.load (RT.java:424)
clojure.core/load/fn--6839 (core.clj:6126)
clojure.core/load (core.clj:6125)
clojure.core/load (core.clj:6109)
clojure.core/load-one (core.clj:5908)
clojure.core/load-one (core.clj:5903)
clojure.core/load-lib/fn--6780 (core.clj:5948)
clojure.core/load-lib (core.clj:5947)
Caused by:
IllegalAccessError with-session-classloader does not exist
clojure.core/refer (core.clj:4249)
clojure.core/refer (core.clj:4217)
clojure.core/apply (core.clj:667)
clojure.core/load-lib (core.clj:5966)
clojure.core/load-lib (core.clj:5928)
clojure.core/apply (core.clj:667)
clojure.core/load-libs (core.clj:5985)
clojure.core/load-libs (core.clj:5969)
clojure.core/apply (core.clj:667)
clojure.core/require (core.clj:6007)
clojure.core/require (core.clj:6007)
cider.nrepl/eval7083/loading--6721--auto----7084 (nrepl.clj:1)
[2022-05-11 14:22:59.291 - WARNING] TCP Port 3000 in use.
shadow-cljs - HTTP server available at
shadow-cljs - server version: 2.10.22 running at
shadow-cljs - nREPL server started on port 3333