Fork me on GitHub
#clojurescript
<
2021-12-18
>
anonimitoraf00:12:46

Hi guys, my dev build works fine (and I don't see the error below) but my release build gives me this error

Uncaught TypeError: g[b].bind is not a function
    at app.js:formatted:85780
    at Array.forEach (<anonymous>)
    at app.js:formatted:85779
    at Array.forEach (<anonymous>)
    at Object.shadow$provide.<computed> (app.js:formatted:85778)
    at BS (app.js:formatted:214122)
    at Object.shadow$provide.<computed> (app.js:formatted:85822)
    at BS (app.js:formatted:214122)
    at Object.shadow$provide.<computed> (app.js:formatted:85952)
    at BS (app.js:formatted:214122)
Steps to diagnose why/make it easier to debug this?

thheller07:12:12

The term you are looking for is "externs". It is likely you are missing some. It should help to run shadow-cljs release the-build --pseudo-names or shadow-cljs release the-build --debug

thheller07:12:10

In short some property is getting renamed but the g[b] suggests you are trying to access the property by its string value which then accesses a non existent property since it was renamed

anonimitoraf11:12:58

Thanks @U05224H0W! I'm reading through https://shadow-cljs.github.io/docs/UsersGuide.html

Release debugging commands.
$ shadow-cljs check app
$ shadow-cljs release app --debug
So where do I start looking after I've built with the --debug flag?

anonimitoraf13:12:03

Ah I see

shadow$provide[1322] = function(global,require,module,exports) {
var DomUtils = module.exports;

[
	require("./lib/stringify"),
	require("./lib/traversal"),
	require("./lib/manipulation"),
	require("./lib/querying"),
	require("./lib/legacy"),
	require("./lib/helpers")
].forEach(function(ext){
	Object.keys(ext).forEach(function(key){
		DomUtils[key] = ext[key].bind(DomUtils);
	});
});

};

thheller17:12:52

hmm so this happens somewhere in npm code. kinda unsure what to do then. it is definitely externs related but finding which externs you need exactly is kinda tricky like that

anonimitoraf00:12:14

Here's my project.clj , node version is 16.13.1 , I can give out other details if necessary

Scott G00:12:45

What are some commonly used libraries /examples of writing a string to a new pdf file using ClojureScript or NodeJs? I've come across the npm package pdfkit, but was wondering if there is a way to do just using the npm library ‘fs’ and .writeFile function, without bringing in another dependency.

Scott G00:12:49

As a follow up, once I have a file written to the file system, how do I download/send that file as a response to a Cloud function request?

Scott G00:12:57

Essentially, I have a json file in Cloud Storage. I can download it using the sdk to the server file system, and after running some transformations on it, I would now like to write it to a pdf file, and then send that pdf file as a response to the client as part of the Firebase / Cloud Function response.

Muhammad Hamza Chippa11:12:09

just like on-change and on-click events does clojurescript supports on-mousedown and on-mouseup event ?

p-himik12:12:27

Those events have nothing to do with CLJS. If something can be done in JS, it can be done one way or another in CLJS. What matters more is what UI libraries/frameworks you're using, if any. But chances are, those events are supported as well.

Muhammad Hamza Chippa12:12:46

Thanks I want to ask another question that in JS we write on-change and on-click function like {()=> console.log("Event Happened")} what is equivalent of it in CLJS ?

p-himik12:12:52

() => ... is JS syntax to create a nameless function, a lambda. {...} around it are probably for React, to let it know that the thing inside is a JS value (or something like that, I'm not a React dev). So you just have to create a regular CLJS function, that's it. Like #(...) or (fn [] ...).

1
Muhammad Hamza Chippa13:12:56

Thank you that is helpful