This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-04-01
Channels
- # announcements (14)
- # beginners (6)
- # biff (6)
- # calva (3)
- # cider (7)
- # clojure (79)
- # clojure-europe (5)
- # clojure-norway (9)
- # cursive (9)
- # data-science (20)
- # datomic (3)
- # fulcro (9)
- # graalvm (15)
- # integrant (2)
- # introduce-yourself (2)
- # jobs (1)
- # lsp (7)
- # malli (5)
- # off-topic (130)
- # parinfer (11)
- # pedestal (11)
- # portal (1)
- # practicalli (4)
- # releases (3)
- # remote-jobs (1)
- # ring (8)
- # ring-swagger (30)
- # shadow-cljs (9)
- # sql (10)
- # tools-deps (8)
Hi, can some one please tell me how to connect to custom node repl. in shadow-cljs.end :buid key I've put
:node-app {:target :node-script
:output-to "resources/app.js"
:main app.main.test/main}
with code
(ns app.main.test)
(defn main []
(js/console.log "Hi"))
I then run shadow-cljs watch node-app
and in second terminal node resources/app.js
but when I connect to repl using emacs cider or vscode calva.
and run js/__dirname
it says __dirname is not defined
. Instead if I choose :node-repl from the connect menu and then run the command it correctly outputs "."
.__dirname
is a "special" constant that is not available in the REPL generally as it is based on the filename of the currently executing file. REPL isn't based on files 😛
feel free to make a repo with instructions and reproduced only with npx shadow-cljs cljs-repl node-app
(no calva/cider)
although node-repl
is just a :node-script
build, so not sure what the problem may be
When I convert a shadow build from :node-library
to :esm
and then change the code using it from const lib = require('@compiled/js')
to import * as lib from '@compiled/js'
, I start seeing new keys in the lib
object: $APP
, $jscomp
, and shadow$provide
(in addition to the ones I'm explicitly exporting). Is that expected / necessary?
strictly speaking only necessary for multi module builds, but currently always exist
OK. I have no reason to be concerned about them, was just curious. Thanks!