This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-21
Channels
- # announcements (4)
- # architecture (161)
- # autochrome-github (7)
- # babashka (61)
- # beginners (42)
- # calva (24)
- # cider (22)
- # clj-kondo (28)
- # cljs-dev (8)
- # clojure (88)
- # clojure-art (2)
- # clojure-dev (7)
- # clojure-europe (43)
- # clojure-germany (2)
- # clojure-nl (2)
- # clojure-uk (4)
- # clojurescript (32)
- # core-async (41)
- # cursive (32)
- # datahike (6)
- # datomic (9)
- # emacs (22)
- # events (2)
- # fulcro (10)
- # graphql (1)
- # nextjournal (16)
- # off-topic (9)
- # overtone (1)
- # pathom (16)
- # polylith (5)
- # quil (7)
- # rdf (1)
- # re-frame (7)
- # reagent (22)
- # releases (2)
- # remote-jobs (1)
- # reveal (12)
- # sci (1)
- # shadow-cljs (12)
- # specter (20)
- # sql (6)
- # tools-deps (21)
- # vim (26)
- # xtdb (10)
Hey all, I get an error I seemingly can't resolve...
Failed to inspect file
app/node_modules/fsevents/fsevents.node
it was required from
app/node_modules/fsevents/fsevents.js
Errors encountered while trying to parse file
app/node_modules/fsevents/fsevents.node
{:line 1, :column 0, :message "Character '�' (U+FFFD) is not a valid identifier start char"}
The full build config is:
{:target :esm
:output-dir "resources/js/compiled/backend"
:output-to "resources/js/compiled/backend/main.mjs"
:modules {:main {:init-fn app.backend/main}}}
The error comes from fsevents doing require('./fsevents.node')
which fails as the thing is a native module...
It there any way to tell shadow-clsj (or... who's actually implementing that require
fn here?) to not parse *.node
as potential js files?
Hm, I was banging my head against this for a couple of days and, as soon as I posted the question here, I seemingly have found a solution: just saying adding :js-options {:js-provider :require}
seems to resolve the issue. Hm...
Well, no... it now fails trying to access WebSocket:
file:///...app/resources/js/compiled/backend/cljs-runtime/shadow.cljs.devtools.client.websocket.js:5
var socket = (new WebSocket(ws_url));
^
ReferenceError: WebSocket is not defined
at shadow$cljs$devtools$client$websocket$start (file:///...app/resources/js/compiled/backend/cljs-runtime/shadow.cljs.devtools.client.websocket.js:5:14)
at Object.attempt_connect_BANG_ (file:///...app/resources/js/compiled/backend/cljs-runtime/shadow.cljs.devtools.client.shared.js:482:128)
at Object.shadow$cljs$devtools$client$shared$init_runtime_BANG_ [as init_runtime_BANG_] (file:///...app/resources/js/compiled/backend/cljs-runtime/shadow.cljs.devtools.client.shared.js:970:16)
at file:///...app/resources/js/compiled/backend/cljs-runtime/shadow.cljs.devtools.client.browser.js:1230:36
at ModuleJob.run (node:internal/modules/esm/module_job:185:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:281:24)
at async loadESM (node:internal/process/esm_loader:88:5)
at async handleMainPromise (node:internal/modules/run_main:65:12)
if you intend this to run in node you should set :js-options {:js-provider :import}
in your build config
otherwise defaults to :browser
and trying to bundle everything (which is not required for node)
I’ve noticed that there are options in :devtools
key in builds that are not in the user manual…
{:http-port 8022
:http-resource-root "public"
:http-root "resources/public/js/test"}
is there additional documentation where it’s described how these work?