Fork me on GitHub
#clojurescript
<
2022-06-17
>
dominicm14:06:10

Has anyone had a stab at getting webpack-dev-server working with :target :bundle?

Benjamin Solum15:06:46

I recently upgraded from shadow 2.15.12 to 2.19.3. I've been trying to generate reports and I'm still seeing it trying to use the 2.15.12 version. At first I figured it was my cache, but I've dumped node_modules, I've switched npm versions, and everything still ends up using 2.15.12. I started to wonder, is there something up with the reporter? Or is it some hidden cache thing I've yet to clear out? Anyone able to generate reports on a newer version that 2.15.12?

âś… 1
p-himik15:06:40

Does you deps.edn or project.clj refer to 2.19.3? Do you maybe have a running shadow-cljs process in that project's directory?

Benjamin Solum15:06:05

Yep, it was the deps.edn , completely blanked it as my shadow builds were using 2.19.3 as expected. Thanks!

đź‘Ť 1
pinkfrog15:06:42

I can invoke fine with (js/window.history.go -1) but it throws Illegal invocation error if I invoke with (def a (partial js/window.history.go -1)) and then (a)

p-himik15:06:55

You probably need to bind that go function to js/window.history.

pinkfrog23:06:14

Any example on this?

pinkfrog00:06:08

I see, you were say bind like this let f = document.getElementsByTagName.bind(document)

đź‘Ť 1
pez17:06:08

Trying to use this example as a receipt for requiring an npm module https://clojurescript.org/news/2017-07-12-clojurescript-is-not-an-island-integrating-node-modules. The REPL starts and the page is rendered, but I get errors about some @cljs-oss/module :

% clj -M --main cljs.main --compile converter.core --repl
node:internal/modules/cjs/loader:942
  throw err;
  ^
Error: Cannot find module '@cljs-oss/module-deps'
Require stack:
- /Users/pez/Projects/DartClojure/npm-example-app/[eval]
    at Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
    at Module._load (node:internal/modules/cjs/loader:780:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at [eval]:8:13
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:305:38)
    at node:internal/process/execution:76:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:75:60) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Users/pez/Projects/DartClojure/npm-example-app/[eval]' ]
}
Node.js v18.0.0
ClojureScript 1.11.54
cljs.user=> 
I the tried with npm install @cljs-oss/module, giving me another error:
% clj -M --main cljs.main --compile converter.core --repl
node:events:505
      throw er; // Unhandled 'error' event
      ^
Error: Parsing file /Users/pez/Projects/DartClojure/npm-example-app/node_modules/dartclojure/target/node-lib/index.js: Unterminated string constant (825:23)
    at Deps.parseDeps (/Users/pez/Projects/DartClojure/npm-example-app/node_modules/@cljs-oss/module-deps/index.js:483:28)
    at getDeps (/Users/pez/Projects/DartClojure/npm-example-app/node_modules/@cljs-oss/module-deps/index.js:415:40)
    at /Users/pez/Projects/DartClojure/npm-example-app/node_modules/@cljs-oss/module-deps/index.js:399:32
    at ConcatStream.<anonymous> (/Users/pez/Projects/DartClojure/npm-example-app/node_modules/concat-stream/index.js:36:43)
    at ConcatStream.emit (node:events:539:35)
    at finishMaybe (/Users/pez/Projects/DartClojure/npm-example-app/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:475:14)
    at endWritable (/Users/pez/Projects/DartClojure/npm-example-app/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:485:3)
    at Writable.end (/Users/pez/Projects/DartClojure/npm-example-app/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:455:41)
    at DestroyableTransform.onend (/Users/pez/Projects/DartClojure/npm-example-app/node_modules/readable-stream/lib/_stream_readable.js:577:10)
    at Object.onceWrapper (node:events:641:28)
Emitted 'error' event on Deps instance at:
    at Deps.parseDeps (/Users/pez/Projects/DartClojure/npm-example-app/node_modules/@cljs-oss/module-deps/index.js:483:14)
    at getDeps (/Users/pez/Projects/DartClojure/npm-example-app/node_modules/@cljs-oss/module-deps/index.js:415:40)
    [... lines matching original stack trace ...]
    at Object.onceWrapper (node:events:641:28)
Node.js v18.0.0
ClojureScript 1.11.54
cljs.user=> 
Not sure what to make of it. Also not sure if it matters that the module I am trying to us is local, living in the parent dir, installed with npm i .. .

dnolen23:06:36

This is the old way where you process stuff through Closure it generally does not work

pez07:06:00

Is there a new way I should be using?

pez10:06:01

This turned out to be a configuration error of mine in the npm package I am building. It now works. Still curious about how a minimal ClojureScript app using an npm module should be built these days.

pez06:06:24

Spoke too early. Ran up against a new stumbling block, and never got this to work. I eventually used shadow-cljs instead,

wcohen20:08:11

@U0ETXRFEW did you ever get this resolved? i’m running into it too with a local module, and hesitate to jump to shadow just yet

pez07:08:09

No, didn’t figure it out.

Drew Verlee21:06:36

i'm getting the warning: datascript.db/equiv-datom declared arglists ([a b]) mismatch defined arglists ([d o]) but i don't understand what it's telling me what. i see that [a b] is different then [d o] but where are they coming from? the error shows me this:

198 | (defn- equiv-datom [^Datom d ^Datom o]
 199 |   (and (= (.-e d) (.-e o))
 200 |        (= (.-a d) (.-a o))
 201 |        (= (.-v d) (.-v o))))
 202 | 
so that's [d o] do where is [a b] that there can be a mismatch? like how are they being "matched"?

Drew Verlee21:06:20

i'm guessing the practical answer is that i should try updating datascript...

Drew Verlee22:06:11

updating datascript does remove the warnings.

thheller06:06:28

the warning should come from the declare with different :arglists before the defn-