This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-24
Channels
- # announcements (10)
- # aws-lambda (9)
- # babashka (14)
- # beginners (166)
- # calva (63)
- # chlorine-clover (4)
- # cider (40)
- # cljs-dev (4)
- # clojure (182)
- # clojure-europe (18)
- # clojure-italy (5)
- # clojure-nl (5)
- # clojure-spec (17)
- # clojure-uk (55)
- # clojurescript (11)
- # core-async (12)
- # cursive (23)
- # datascript (5)
- # datomic (19)
- # emacs (4)
- # fulcro (46)
- # graalvm (2)
- # hoplon (2)
- # joker (3)
- # juxt (1)
- # keechma (2)
- # leiningen (20)
- # malli (1)
- # meander (7)
- # nrepl (1)
- # off-topic (72)
- # pedestal (6)
- # re-frame (15)
- # reitit (7)
- # shadow-cljs (34)
- # sql (14)
- # testing (14)
- # tools-deps (11)
- # tree-sitter (1)
- # vim (14)
- # xtdb (19)
- # yada (3)
i have this INFO warning with one module, i haven't noticed issues in my app so far but what could be the consequences of such an "invalid-required"
node: v11.13.0
shadow-cljs - server version: 2.8.51 running at
shadow-cljs - nREPL server started on port 52448
[2020-03-24 11:42:40.454 - INFO] :shadow.build.npm/js-invalid-requires - {:resource-name "node_modules/eth-lib/lib/bytes.js", :requires [{:line 9, :column 193}]}
got it, dynamic require, interesting line in that library 😅
if (typeof window !== "undefined" && window.crypto && window.crypto.getRandomValues) rnd = window.crypto.getRandomValues(new Uint8Array(bytes));else if (typeof require !== "undefined") rnd = require("c" + "rypto").randomBytes(bytes);else throw "Safe random numbers not available.";
yeah thats specifically to stop bundlers from bundling the crypto package since dynamic requires are still pretty much an unsolved problem
make sense - thanks!
I have a cljs/React front end that I have been hosting with the shadow-cljs :dev-http
I have a clojure backend running on pedestal/jetty
I am now at the point where I would like to establish a websocket connection between the two; Ideally I would like to serve the front-end from Pedestal server AND connect a shadow-cljs repl to this session;
When I serve the html pages from pedestal however, I cannot get the cljs repl started; I get
> No application has connected to the REPL server. Make sure your JS environment has loaded your compiled ClojureScript code.
I can see that shadow-cljs :run-dev somehow injects
into the webpage
and I can see that Pedestal server does not do this
and I presume that this is why it does not make a repl connection; Where does this repl websocket get injected? How can I get Pedestal server to do the same thing?@ben.hammond you don't need to configure pedestal in any way. the websocket connection is made to the shadow-cljs server which is completely separate
this also has nothing to do with :dev-http
. that is strictly serving static files only.
oh so the REPL ws connection should be identical wherever the cljs files are server from
the websocket connection is made to the shadow-cljs server which is running on port 9630
ah right I see I see thanks!
Hope everyone is well. I’m working with Higcharts using https://github.com/kirjs/react-highcharts and things are going fine until I want to use the “Sankey” style chart (https://www.highcharts.com/demo/sankey-diagram). This is provided in a separate JS file (https://code.highcharts.com/modules/sankey.js). The Highchart fiddle just shows adding the sankey.js to your html and it works. Except it doesn’t since I’m using the npm package. I can’t figure out how to get the react component to find this extra code/module. I added the sankey.js to the html and even tried https://github.com/clarketm/highcharts-more, but that package doesn’t seen to include Sankey. I keep getting “Error: Highcharts error #17: http://www.highcharts.com/errors/17/?missingModuleFor=sankey missingModuleFor: sankey” Has anyone figured out how to get this to work?
@wasser you probably can import it from the highcharts npm module. check if you can find a sankey file in node_modules/highcharts
Hi, I'm trying to use a node module on Shadow-CLJS, but it's not raising the error:
'"module$node_modules$nrepl_client$src$nrepl_client is not defined"'
The node module is nrepl-client
, I'm trying to require it with ["nrepl-client" :as nrepl]
, shadow-cljs target is node-library
If I use js/require
it works correctly
I’m having trouble with my production build (targeting the browser). When loading index.html
in the browser I get an error in the JavaScript console: ReferenceError: Can't find variable foo
where my init-function is foo.core/init
. In development mode everything works find…
In shadow-cljs.edn
I tried:
:modules {:main {:init-fn foo.core/init}}
and
:modules {:main {:entries [foo.core]}}
my index.html
looks like this:
<html lang="en">
<head>
<!-- ... -->
<script src="/js/compiled/main.js"></script>
</head>
<body>
<div id="app"></div>
<script>foo.core.init();</script>
</body>
</html>
Yes, it happens during load…
TypeError: undefined is not an object (evaluating '$N.call')
iO — main.js:1126:113
cN — main.js:1128:348
(anonymous function) — main.js:1061:406
(anonymous function) — main.js:1061:441
Global Code — main.js:1800
ReferenceError: Can't find variable: foo
Global Code —
where `
where line 18 of index.html is:
<script>foo.core.init();</script>
Solved. I used the --debug option when compiling my production code and it turned out that there was some debug code using cljs.pprint/pprint without explicitly requiring it. So shadow-cljs release foo --debug
did the trick and produced some useful output to the JavaScript console in the browser to track down the problem. Instead of (evaluating '$N.call')
in the logs above I got some hints to hat it was related to pprint
…
@thheller I found a sankey.js file in node_modules/highcharts/modules
so tried adding ‘[“highcharts/modules/sankey.js”]’ to the namespace, but I still get the “error 17, missing module for sankey”. Do I need to add the dependency somewhere else?
I have no idea sorry. maybe you need to initialize it somehow. highcharts probably has some docs for that?
Did you try to put the file somewhere else?
Like where you have your usual highcharts dependency?
What about removing the .js at the end of your import?
None of those (putting the js file someplace, adding it to the html, dropping the .js) worked - stil getting “Error 17”. I found another react lib to try
which apparently includes the sankey stuff directly so I don’t get the “Error 17", but if fails in a different way: “undefined is not an object (evaluating ‘t.chart’)” Now I’m trying to get some source-maps, so I have a chance of figuring out what this issue really is (shadow-cljs noob).