This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-24
Channels
- # announcements (6)
- # architecture (9)
- # aws (2)
- # babashka (49)
- # beginners (160)
- # boot (19)
- # calva (9)
- # cider (16)
- # clj-kondo (17)
- # cljfx (9)
- # clojure (143)
- # clojure-australia (5)
- # clojure-berlin (1)
- # clojure-czech (3)
- # clojure-europe (64)
- # clojure-france (1)
- # clojure-italy (12)
- # clojure-nl (4)
- # clojure-spec (6)
- # clojure-uk (47)
- # clojurescript (27)
- # code-reviews (5)
- # conjure (45)
- # cursive (47)
- # datascript (2)
- # datomic (21)
- # events (1)
- # fulcro (9)
- # graalvm (4)
- # graphql (2)
- # jackdaw (22)
- # jobs (3)
- # kaocha (6)
- # london-clojurians (1)
- # luminus (4)
- # malli (19)
- # meander (136)
- # pathom (4)
- # pedestal (2)
- # re-frame (15)
- # reitit (2)
- # remote-jobs (2)
- # rum (12)
- # sci (1)
- # shadow-cljs (100)
- # spacemacs (10)
- # sql (1)
- # tools-deps (30)
- # vrac (1)
- # xtdb (30)
@daemianmack you can just run shadow-cljs watch build1 build2 build3
and then shadow-cljs cljs-repl build1
and so on (or nrepl) to talk to a specific REPL for a given build
you can have as many REPLs as you want but most editors don't do session management very well
hi, when upgrading from 2.9.2
to the latest version, there is an error on Android, but works fine on ios , react native project
@thheller there is an instant crash with shadow-cljs on react-native when using the hermes engine "Property Long doesn't exist" related to goog.math.long.js . I bisected through shadow-cljs versions and it looks like 2.9.4 is clean, 2.9.5 is not on npm, and 2.9.6 has the bug
we are not using goog.math.long anywhere directly, but it looks like transit does indirectly
since it works fine in release I wonder if that could be related to this commit https://github.com/thheller/shadow-cljs/commit/c5ce449c5749c9a7dd7ed0f9d58ec5f78b826e03
or maybe even just the goog module hot-reload https://github.com/thheller/shadow-cljs/commit/659e6eb72f7ed0f2acaf57e5d4502bf24884646c
I don't have a clue. goog.math.Long
is used by cljs.core
. sounds like a bug in hermes to me though?
It can't be a bug in hermes because there is no bug in shadow-cljs 2.9.4, and no bug in release
just set :version "2.9.5"
in shadow-cljs.edn
(assuming you use neither project.clj nor deps.edn)
is there more to the "Property Long doesn't exist" error though? I can't do much without knowing what the actual code is that crashes
yenda@desktop:~/clash-mobile$ shadow-cljs compile app
shadow-cljs - config: /home/yenda/clash-mobile/shadow-cljs.edn cli version: 2.8.76 node: v12.16.1
[:app] Compiling ...
Failed writing cache for taoensso.encore: java.lang.Exception: Not supported: class shadow.build.compiler$analyze$fn__11740
[:app] Build completed. (271 files, 270 compiled, 0 warnings, 11.07s)
shadow-cljs - server version: 2.11.4 running at http://localhost:3449
the last statement I see in the log is loading goog.math.long.js goog.loadModule(function(exports) and then the whole module code
there is a SHADOW_ENV.evalLoad in the file
SHADOW_ENV.evalLoad("goog.math.long.js", "goog.loadModule(function(exports) {\n \x22use strict\x22;\n goog.module(\x22goog.math.Long\x22);\n goog.module.declareLegacyNamespace();\n const asserts \x3d goog.require(\x22goog.asserts\x22);\n const reflect \x3d goog.require(\x22goog.reflect\x22);\n class Long {\n constructor(low, high) {\n this.low_ \x3d low | 0;\n this.high_ \x3d high | 0;\n }\n toInt() {\n return this.low_;\n }\n toNumber() {\n return this.high_ * TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();\n }\n isSafeInteger() {\n var top11Bits \x3d this.high_ \x3e\x3e 21;\n return top11Bits \x3d\x3d 0 || top11Bits \x3d\x3d -1 \x26\x26 !(this.low_ \x3d\x3d 0 \x26\x26 this.high_ \x3d\x3d (4292870144 | 0));\n }\n toString(opt_radix) {\n var radix \x3d opt_radix || 10;\n if (radix \x3c 2 || 36 \x3c radix) {\n throw new Error(\x22radix out of range: \x22 + radix);\n }\n if (this.isSafeInteger()) {\n var asNumber \x3d this.toNumber();\n return radix \x3d\x3d 10 ? \x22\x22 + asNumber : asNumber.toString(radix);\n }\n var safeDigits \x3d 14 - (radix \x3e\x3e 2);\n var radixPowSafeDigits \x3d Math.pow(radix, safeDigits);\n var radixToPower \x3d Long.fromBits(radixPowSafeDigits, radixPowSafeDigits / TWO_PWR_32_DBL_);\n var remDiv \x3d this.div(radixToPower);\n var val \x3d Math.abs(this.subtract(remDiv.multiply(radixToPower)).toNumber());\n var digits \x3d radix \x3d\x3d 10 ? \x22\x22 + val : val.toString(radix);\n if (digits.length \x3c safeDigits) {\n digits \x3d \x220000000000000\x22.substr(digits.length - safeDigits) + digits;\n }\n val \x3d remDiv.toNumber();\n return (radix \x3d\x3d 10 ? val : val.toString(radix)) + digits;\n }\n getHighBits() {\n return this.high_;\n }\n getLowBits() {\n return this.low_;\n }\n getLowBitsUnsigned() {\n return this.low_ \x3e\x3e\x3e 0;\n }\n getNumBitsAbs() {\n if (this.isNegative()) {\n if (this.equals(Long.getMinValue())) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val \x3d this.high_ !\x3d 0 ? this.high_ : this.low_;\n for (var bit \x3d 31; bit \x3e 0; bit--) {\n if ((val \x26 1 \x3c\x3c bit) !\x3d 0) {\n break;\n }\n ...
I mean watch loads more (and connects websocket) but all of that comes after goog.math.Long
@thheller if you look at the module it looks like they are not the same, not sure if that matters but for instance /** @const */ var reflect
in 2.9.4 vs const reflect
in 2.11.4
{:target :react-native
:init-fn app.core/init
:output-dir "app"
:dev {:devtools {
:autoload true
:reload-strategy :full
:after-load app.core/reload
:compiler-options {:source-map false
:output-feature-set :es5}}
:local-ip #shadow/env "SHADOW_HOST"}
:release {:compiler-options {:output-feature-set :es6
:warnings-as-errors true
:infer-externs :auto
:optimizations :advanced
:js-options {:js-provider :closure}}}}
and the modules still have the const reflect
syntax in index.js
SHADOW_ENV.evalLoad("goog.math.long.js", "goog.loadModule(function(exports) {\n \x22use strict\x22;\n goog.module(\x22goog.math.Long\x22);\n goog.module.declareLegacyNamespace();\n const asserts \x3d goog.require(\x22goog.asserts\x22);\n const reflect \x3d goog.require(\x22goog.reflect\x22);\n class Long {\n constructor(low, high) {\n this.low_ \x3d low | 0;\n this.high_ \x3d high | 0;\n }\n toInt() {\n return this.low_;\n }\n toNumber() {\n return this.high_ * TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();\n }\n isSafeInteger() {\n var top11Bits \x3d this.high_ \x3e\x3e 21;\n return top11Bits \x3d\x3d 0 || top11Bits \x3d\x3d -1 \x26\x26 !(this.low_ \x3d\x3d 0 \x26\x26 this.high_ \x3d\x3d (4292870144 | 0));\n }\n toString(opt_radix) {\n var radix \x3d opt_radix || 10;\n if (radix \x3c 2 || 36 \x3c radix) {\n throw new Error(\x22radix out of range: \x22 + radix);\n }\n if (this.isSafeInteger()) {\n var asNumber \x3d this.toNumber();\n return radix \x3d\x3d 10 ? \x22\x22 + asNumber : asNumber.toString(radix);\n }\n var safeDigits \x3d 14 - (radix \x3e\x3e 2);\n var radixPowSafeDigits \x3d Math.pow(radix, safeDigits);\n var radixToPower \x3d Long.fromBits(radixPowSafeDigits, radixPowSafeDigits / TWO_PWR_32_DBL_);\n var remDiv \x3d this.div(radixToPower);\n var val \x3d Math.abs(this.subtract(remDiv.multiply(radixToPower)).toNumber());\n var digits \x3d radix \x3d\x3d 10 ? \x22\x22 + val : val.toString(radix);\n if (digits.length \x3c safeDigits) {\n digits \x3d \x220000000000000\x22.substr(digits.length - safeDigits) + digits;\n }\n val \x3d remDiv.toNumber();\n return (radix \x3d\x3d 10 ? val : val.toString(radix)) + digits;\n }\n getHighBits() {\n return this.high_;\n }\n getLowBits() {\n return this.low_;\n }\n getLowBitsUnsigned() {\n
2.9.4:
SHADOW_ENV.evalLoad("goog.math.long.js", "goog.loadModule(function(exports) {\n \x22use strict\x22;\n goog.module(\x22goog.math.Long\x22);\n goog.module.declareLegacyNamespace();\n /** @const */ var asserts \x3d goog.require(\x22goog.asserts\x22);\n /** @const */ var reflect \x3d goog.require(\x22goog.reflect\x22);\n /** @final @constructor */ var Long \x3d function(low, high) {\n /** @private @const @type {number} */ this.low_ \x3d low | 0;\n /** @private @const @type {number} */ this.high_ \x3d high | 0;\n };\n /**\n * @return {number}\n */\n Long.prototype.toInt \x3d function() {\n return this.low_;\n };\n /**\n * @return {number}\n */\n Long.prototype.toNumber \x3d function() {\n return this.high_ * TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();\n };\n /**\n * @return {boolean}\n */\n Long.prototype.isSafeInteger \x3d function() {\n var top11Bits \x3d this.high_ \x3e\x3e 21;\n return top11Bits \x3d\x3d 0 || top11Bits \x3d\x3d -1 \x26\x26 !(this.low_ \x3d\x3d 0 \x26\x26 this.high_ \x3d\x3d (4292870144 | 0));\n };\n /**\n * @param {number\x3d} opt_radix\n * @return {string}\n * @override\n */\n Long.prototype.toString \x3d function(opt_radix) {\n var radix \x3d opt_radix || 10;\n if (radix \x3c 2 || 36 \x3c radix) {\n throw new Error(\x22radix out of range: \x22 + radix);\n }\n if (this.isSafeInteger()) {\n var asNumber \x3d this.toNumber();\n return radix \x3d\x3d 10 ? \x22\x22 + asNumber : asNumber.toString(radix);\n }\n var safeDigits \x3d 14 - (radix \x3e\x3e 2);\n var radixPowSafeDigits \x3d Math.pow(radix, safeDigits);\n var radixToPower \x3d Long.fromBits(radixPowSafeDigits, radixPowSafeDigits / TWO_PWR_32_DBL_);\n var remDiv \x3d this.div(radixToPower);\n var val \x3d Math.abs(this.subtract(remDiv.multiply(radixToPower)).toNumber());\n var digits \x3d radix \x3d\x3d 10 ? \x22\x22 + val : val.toString(radix);\n if (digits.length \x3c safeDigits) {\n digits \x3d \x220000000000000\x22.substr(digits.length - safeDigits) + digits;\n }\n val \x3d remDiv.toNumber();\n return (radix \x3d\x3d 10 ? val : val.toString(radix)) + digits;\n };\n /**\n * @return {number}\n */\n Long.prototype.getHighBits \x3d function() {\n return this.high_;\n };\n /**\n * @return {number}\n */\n Long.prototype.getLowBits \x3d function() {\n return this.low_;\n };\n /**\n
@thheller ok looks like it works when I put compiler options at the top level of my build
so this line doesn't look into :dev and set es6 as default? https://github.com/thheller/shadow-cljs/commit/ad8ea9d4aefc5d1c0ab371613a9c96c17da3d447#diff-022dc5a1b7d0a256b0203406d97d8eb8R147
@thheller so the fix for now is to have :compiler-options {:output-feature-set :es5}
at the top level of your build config map when you want to use hermes on react-native target
Anyone have experience with doing the :target :karma
and it not launching the headless chrome when running npx karma start --single-run
?
Hello everyone! Seems when I sometimes reload my browser window, vim-fireplace is loosing the connection with the page and cannot re-establish it. Trying to send commands after this happens show the following error:
[2020-09-24 13:16:06.847 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:op :cljs-load-sources, :sources [[:shadow.build.classpath/resource "cljs/spec/gen/alpha.cljs"] [:shadow.build.classpath/resource "cljs/spec/alpha.cljs"] [:shadow.build.classpath/resource "cljs/repl.cljs"] [:shadow.cljs.repl/resource "cljs/user.cljs"]], :call-id 1, :from 24}}
ExceptionInfo no output for id: [:shadow.cljs.repl/resource "cljs/user.cljs"] {:resource-id [:shadow.cljs.repl/resource "cljs/user.cljs"]}
shadow.build.data/get-output! (data.clj:197)
shadow.build.data/get-output! (data.clj:193)
shadow.cljs.devtools.server.worker.impl/fn--15169/fn--15172 (impl.clj:813)
clojure.core/map/fn--5866 (core.clj:2753)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:51)
clojure.lang.RT.seq (RT.java:535)
clojure.core/seq--5402 (core.clj:137)
clojure.core.protocols/seq-reduce (protocols.clj:24)
clojure.core.protocols/fn--8146 (protocols.clj:75)
clojure.core.protocols/fn--8146 (protocols.clj:75)
clojure.core.protocols/fn--8088/G--8083--8101 (protocols.clj:13)
My config currently looks like this, basically the minimal one I could get my hands on.
;; shadow-cljs configuration
{:source-paths
["src/dev"
"src/main"
"src/test"]
:dependencies
[[reagent "1.0.0-alpha2"]]
:dev-http {8081 "public"}
:nrepl {:port 8082}
:builds
{:frontend
{:target :browser
:modules {:main {:init-fn app/init}}}}}
I come from using figwheel and figwheel-main for a long time, first time using shadow-cljs for a project, so probably I'm doing something wrong here. Using neovim, vim-fireplace. Running shadow-cljs by running npx shadow-cljs watch frontend
, connecting my repl by doing :Connect 8082
and then :Piggieback :frontend
. Everything works except until I reload the page, then starting to get that error above and the only thing I can do to make it work is restarting shadow-cljs watch
again, then it starts working.@victorbjelkholm429 which version is this? this should have been fixed a while ago.
@thheller 2.11.4, think the project was bootstrapped from create-cljs-project
so got the version from there
@thheller was behind a few commits in vim-fireplace. Upgraded and now not getting the error again... But will keep trying to reproduce, but seems fixed now. Well, thanks for the rubberducking @thheller 🙂
so this line doesn't look into :dev and set es6 as default? https://github.com/thheller/shadow-cljs/commit/ad8ea9d4aefc5d1c0ab371613a9c96c17da3d447#diff-022dc5a1b7d0a256b0203406d97d8eb8R147
@andre why would it? its not supposed to? it is supposed to be identical in dev/release?
I say again ... this very much sounds like a bug in hermes to me if it works in other engines
and again .. I suspect eval
to be the cause here. release
builds will not eval
and instead load the code directly.
the code shadow-cljs produces looks exactly like it should, :es5
should not be a required setting but if it makes hermes happy then fine just set it
you can set :dev {:compiler-options {:output-feature-set :es5}}
if you only want it in dev
it doesn't work if you set it in dev @thheller, I had to set it in the top level of the build map
Is there a way to write jsx file alongside cljs and import the components in cljs files? It works with js but I don't understand the stack enough to figure out how to make sure the jsx stuff gets transpiled
Not having any luck attempting to use oz via shadow-cljs. At first I just tried going by the instructions in the Oz github readme, but kept running into an error with a missing file. Shadow-cljs was looking for a .js file, but in the folder only .min.js, .node.js and .module.js were available. Then I found this template project and the exact same error occurs: https://github.com/ivanminutillo/reagent-shadow-oz-example
[:app] Build failure:
override to file that doesn't exist
{:tag :shadow.build.npm/invalid-override, :require-from #object[java.io.File 0x4d68156d "/Users/rqf595/Code/temp/reagent-shadow-oz-example/node_modules/vega-dataflow/build/vega-dataflow.js"], :require "vega-loader", :file #object[java.io.File 0x41ebcb92 "/Users/rqf595/Code/temp/reagent-shadow-oz-example/node_modules/vega-loader/build/vega-loader.node.js"], :override "./build/vega-loader.js", :override-file #object[java.io.File 0x5d156b61 "/Users/rqf595/Code/temp/reagent-shadow-oz-example/node_modules/vega-loader/build/vega-loader.js"]}
ExceptionInfo: override to file that doesn't exist
shadow.build.npm/find-resource (npm.clj:735)
shadow.build.npm/find-resource (npm.clj:661)
shadow.build.resolve/find-npm-resource (resolve.clj:123)
shadow.build.resolve/find-npm-resource (resolve.clj:94)
wow, this is the first time I've seen that message in my builds and you already asked about it 🙂. Quite a coincidence
I would almost say that there is some new version of vega, and since package.json usually imports "^version", we both got upgraded at the same time
So now I’m wondering what to do? The packages are installed, but shadow-cljs is looking for e.g. vega-loader.js when only files like vega-loader.min.js is available in that folder.
@simongray not a clue. the package is linking to a file that it does not itself contain. likely just a bad config entry on their part. you can fix it by editing https://github.com/vega/vega/blob/master/packages/vega-loader/package.json#L41 to link to the correct file
Thanks Thomas. I'll attempt that. It just seems odd that a setup that presumably worked at one time using those same versions now doesn't to seem any longer.
current seems to be 4.3.3
but 4.3.2
still had the non-min file https://unpkg.com/browse/[email protected]/build/vega-loader.js
Thanks a lot. That got me on the right track. I managed to get it to compile by adding these two explicit dependencies to the package.json
"vega-loader": "4.3.2",
"vega-canvas": "1.2.4"
apparently, version 1.2.5 of the vega-canvas package suffered from the same issue.@U01BL8MKU7K Jeg fandt ud af hvad problemet var med lidt hjælp fra Thomas.
Hurra!