This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-04-26
Channels
- # announcements (10)
- # aws (5)
- # babashka (27)
- # beginners (175)
- # boot (1)
- # braveandtrue (2)
- # calva (11)
- # cider (13)
- # clj-kondo (91)
- # cljs-dev (54)
- # cljsrn (20)
- # clojure (164)
- # clojure-gamedev (3)
- # clojure-uk (43)
- # clojurescript (185)
- # core-async (6)
- # core-typed (1)
- # cursive (1)
- # docker (2)
- # emacs (2)
- # figwheel-main (78)
- # fulcro (69)
- # off-topic (20)
- # pathom (30)
- # planck (3)
- # re-frame (6)
- # reagent (70)
- # reitit (26)
- # ring (1)
- # shadow-cljs (120)
- # tools-deps (6)
- # vim (9)
hello, I'm trying to add electron-updater to an app, but when the app starts I see this error shadow.js.shim.module$electron_updater.AppUpdater.checkForUpdatesAndNotify is not a function
is shadow addimg some shim around electron_updater?
shadow.js.shim.module$electron_updater = require("electron-updater");
is basically what it does
Not sure, but have you tried to hint that this is ^js
like in this part of the doc: https://shadow-cljs.github.io/docs/UsersGuide.html#externs? If you do that it shouldn't rename that function during compilation.
Is there a way to require
data from a .edn
file?
kind of when in webpack one can import a .json
file?
Hi! I need some help, I'm new to shadow-cljs and unfamiliar with the larger JS/node ecosystem. I'm trying to import a npm package using shadow-cljs (the package is called ipfs) and use it in a browser app (:target is :browser). However, the compilation fails on the "crypto" package. ("The required JS dependency "crypto" is not available, it was required by "node_modules/nanoid/index.cjs".). From what I understand, crypto is something provided by node.js and not normally available in browsers. Does it mean that I need to use some kind of packer (like browserify or webpack) or can I somehow configure shadow-cljs to help me with that?
install shadow-cljs in the project itself. that will bring in a few polyfills for packages like those
but it also just might be that the package you are trying to use isn't compatible with the browser at all
Thanks! I do have shadow-cljs installed locally both. I tried both with --save and --save-dev (dunno if there's a difference). I didn't manage to get it working though. I'll stick to the CDN version and if I ever get deeper into this project, I might check what does webpack do differently. Regardless of that, thanks for shadow-cljs!
Oh, I can override it via :resolve in in :js-options. Is this how it's commonly done? Do I need to manually craft them for every node module?
is there a react-native framework or template for shadow like re-natal is for Figwheel?
;; shadow-cljs.edn in project
{:deps {:aliases [:cljs]}}
;; ~/.shadow-cljs/config.edn
{:deps-aliases [:cider]}
What's difference between using :deps
and :deps-aliases
?@ahmed1hsn the difference is that :deps-aliases
allies to all projects and thus uses a different name
@pshar10 I only made a couple examples for RN, otherwise you just use shadow-cljs. nothing more specific for RN really. https://github.com/thheller/reagent-expo https://github.com/thheller/reagent-react-native
Sometimes when loading a function, I get the following error in the repl:
no source by provide: myapp.workspaces.dom
{:provide myapp.workspaces.dom}
ExceptionInfo: no source by provide: myapp.workspaces.dom
shadow.build.data/get-source-id-by-provide (data.clj:184)
shadow.build.data/get-source-id-by-provide (data.clj:181)
shadow.build.data/get-source-by-provide (data.clj:187)
shadow.build.data/get-source-by-provide (data.clj:186)
shadow.cljs.repl/repl-compile/fn--37359/fn--37360 (repl.clj:453)
shadow.cljs.repl/repl-compile/fn--37359 (repl.clj:429)
shadow.cljs.repl/repl-compile (repl.clj:427)
shadow.cljs.repl/repl-compile (repl.clj:424)
shadow.cljs.repl/process-read-result (repl.clj:515)
shadow.cljs.repl/process-read-result (repl.clj:491)
shadow.cljs.devtools.server.worker.impl/do-repl-rpc (impl.clj:859)
shadow.cljs.devtools.server.worker.impl/do-repl-rpc (impl.clj:813)
shadow.cljs.devtools.server.worker.impl/eval38290/fn--38291 (impl.clj:894)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
shadow.cljs.devtools.server.util/server-thread/fn--37822/fn--37823/fn--37831 (util.clj:285)
shadow.cljs.devtools.server.util/server-thread/fn--37822/fn--37823 (util.clj:284)
shadow.cljs.devtools.server.util/server-thread/fn--37822 (util.clj:257)
java.lang.Thread.run (Thread.java:748)
And the only way out is to quit the repl and start it again. Why would this be?@pshar10 which shadow-cljs do you use? your stacktrace doesn't line up with my code at all? seems like its a rather old version?
please open shadow-cljs clj-repl
and try (
and post the result
This way it actually shows a different version:
( "shadow/cljs/repl.clj")
#object[.URL 0xfee791d "jar:file:/private/var/root/.m2/repository/thheller/shadow-cljs/2.8.93/shadow-cljs-2.8.93.jar!/shadow/cljs/repl.clj"]
is there a way to cause shadow-cljs's debug mode console to show a value? i am trying to debug on a platform without console access.
i mean the text which shows up at the bottom of the window when you have e.g. an undefined symbol in your code at compile time. i wanted to mis-use this to quickly display some value at runtime instead of doing js/alert
but i should probably just install proper tooling instead. or just a pre
tag sorry it was late.
yes, inspect is what i need. WOW.
I can't evaluate things in Calva's :node-library
, atm. The nrepl load-file
op works, but not eval
. It never returns. This happened w/o me upgrading shadow-cljs, which was still on 2.8.77
. Using .102
makes no difference. The only thing I think has changed is my node version, which is now v12.13.0
. Could that be the issue?
It seems that if I restart the extension host (within where my library runs) and then connect the repl again, things start to work. I can live with that, but a bit strange that it started happening. Will use .103
, and see if it says something more about the condition.
@pshar10 you might also want to upgrade to 2.8.103
. at least the errors should log more info now. hopefully that makes figuring out what is happening easier for me. Its just a raw data dump so I don't expect anyone to make sense of it, just report it.
@thheller FYI as of 2.8.102 something broke my (admittedly very unconventional) environment: I was loading a WebAssembly module, and I now see that the (automatically generated) js loader file does a require("fs")
, making shadow-cljs complain with The required JS dependency "fs" is not available
I reverted to 2.8.101 and everything started working again 🙂
I didn't really change any of the polyfill behavior? so as long as you have shadow-cljs in the project it should find fs just fine?
that’s what I thought. I looked at the commits in .102 and couldn’t find the reason for it starting to complain at that point. Btw I can’t share that package as it’s proprietary, but I can try to create a minimal project that replicates the error. What’s the easiest way to setup a shadow-cljs project these days? (My codebase is 2 years old 🙂 )
I only really need the package.json. if its just a blank require("fs")
in the source file then only package.json can modify what that would do
@bru I didn't mean your package.json, I meant the package.json of the package that contains the require("fs")
@thheller ups, gotcha. It doesn’t have one at the moment, it’s a legacy C++ app that’s being converted to a wasm module
eh, no idea. let me try to create that minimal shadow-cljs project, it will definitely be easier to debug a simpler setup
My project depends on a js lib, say "foo", and I have cloned that repo locally. Is it possible to tell shadow-cljs to auto reload it when I modify the source of foo?
{:tag :shadow.build.npm/missing-entries, :entries ["dist/index.js"], :package-dir #object[.File 0x69de6ee "/src/project-mine/node_modules/foo"]}
ExceptionInfo: package in /src/project-my/node_modules/foo specified entries but they were all missing
@wxitb2017 shadow-cljs no longer auto-reloads changes in node_modules
if individual files are modified but it should recompiled if the package.json
of that package is modified
Anyone experienced shadow-cljs interferencing with input methods? I have a form input field in my react application, and as long as I add some println
functions in my on-change function, after typing a char the input method would be automatically switched back from Chinese to system default (English)
And
1. if I disconnect the browser from the repl - the problem magically disappears
2. reproducible on both chrome/ff/safari
3. only println
would cause this problem, OTOH js/console.log is fine
@thheller here’s the minimal project I promised -> https://github.com/bru/minimal-wasm-shadow-cljs
thanks for sharing this!
but doesn't have anything to do with this particular problem. I just messed up a boolean statement 😛
I was too. It is very brittle though, I really don’t like having to keep babel in the picture for example
@thheller those are already in place. You don’t really need to care about the last part of the setup (that’s just if you want to modify the C source).
@thheller added now, in /resources/wasm. I’m also writing a build script to simplify the setup
too late, pushed 😉 babel was the easiest way I found to massage the js files to please the google closure compiler. Honestly for this minimal project it’s overkill, but as said I wanted to replicate the setup of the original one
the only problem I found is the ESM CommonJS interop. the generated libadd.js
is commonjs but you glue.js
was ESM
I switched it to
const WasmAdder = require('./libadd.js');
let add, malloc, free;
const wait = new Promise(done => {
WasmAdder().then(Module => {
malloc = Module._malloc;
free = Module._free;
add = Module.cwrap('add2', 'number', ['number', 'number']);
done();
});
});
exports.add2wasm = function add2wasm(x, y) {
return wait.then(() => { return add(x, y); });
}
and then you can just compile it with only shadow-cljsyup, that makes perfectly sense. the original project is a bit more complex as it includes JS from different styles / sources.
yeah thats an issue. should be either all ESM or all CommonJS. the mix isn't supported well right now
btw, I invited you to the repo. If you want to push that branch, it’d be greatly appreciated