This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-05
Channels
- # announcements (1)
- # babashka (16)
- # beginners (36)
- # biff (1)
- # calva (2)
- # cider (4)
- # cljdoc (1)
- # clojure (118)
- # clojure-austin (2)
- # clojure-czech (2)
- # clojure-europe (19)
- # clojure-norway (3)
- # clojure-spec (8)
- # clojure-uk (3)
- # clojurescript (11)
- # conjure (1)
- # cursive (3)
- # datalevin (5)
- # datomic (7)
- # emacs (16)
- # events (1)
- # figwheel-main (3)
- # fulcro (5)
- # hyperfiddle (17)
- # jobs (2)
- # lsp (19)
- # malli (5)
- # nbb (10)
- # off-topic (5)
- # polylith (5)
- # re-frame (3)
- # reagent (11)
- # remote-jobs (2)
- # shadow-cljs (1)
- # spacemacs (7)
- # web-security (4)
Hello there! I'm looking for a function in clojurescript that would convert clojure identifiers to valid javascript identifiers. Any idea where I could find such function? e.g.
compatible-key? -> compatible_key_QMARK_
or
blah.asdf.qwer -> blah$asdf$qwer
but I guess this function isn't available at runtime, is it?
https://cljs.github.io/api/cljs.core/munge is I think but not at a repl to try it right now
ah good
I thought it wouldn't be available at runtime because you linked from cljs.compiler
but I guess cljs.core/munge should be available yeah
Comes fromClojure core. The documentation is all-but-nonexistent. But a couple examples are offered. https://clojuredocs.org/clojure.core/munge
After generating a standalone (whether wrapping some stuff together via webpack and exporting a module, or using one generated via emcc), I’ve got a project-local .js ES6 module called projjs
, but am struggling to get it loaded into the repl.
Using the webpack/javascript guides and with build.edn
including:
:foreign-libs [{:file "src"
:module-type :es6
:provides ["js.projjs"]
}]
or passing to figwheel with a similar foreign-libs, I’m getting hit with the following error:
[eval]:67
new enhancedResolve.NodeJsInputFileSystem(),
^
TypeError: enhancedResolve.NodeJsInputFileSystem is not a constructor
This happens whether I’ve also got :target :nodejs
set or not.
Is there some other way I’m supposed to be defining a module if it’s going to be included in a project itself, rather than as a transient NPM dependency?Upon further debugging I think I’m into something I notice came up a few months ago: https://clojurians.slack.com/archives/C03S1L9DN/p1655487788508369
This enhancedResolve error seems tied to enhance-resolve
, which is part of @cljs-oss/module-deps
— at some point I did add this to try to get figwheel working, but now if I remove that module, totally blow away node_modules
, and even delete the parent package.json (since I don’t have any npm dependencies), this enhancedResolve
error turns into:
Error: Cannot find module '@cljs-oss/module-deps'
Require stack:
- /Users/wcohen/programming/clj/clj-proj/[eval]
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
...
at evalScript (node:internal/process/execution:75:60) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Users/wcohen/programming/clj/clj-proj/[eval]' ]
}
Unlike the thread noted earlier, this isn’t using the 2017 closure compiler guide, but the new webpack one. Is there an additional step or cache that’s lingering that could be making this spuriously appear?