This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-17
Channels
- # beginners (70)
- # boot (4)
- # cider (16)
- # clara (6)
- # cljdoc (21)
- # cljs-dev (2)
- # cljsrn (1)
- # clojure (73)
- # clojure-finland (2)
- # clojure-nl (6)
- # clojure-russia (35)
- # clojure-sg (1)
- # clojure-spec (14)
- # clojure-uk (146)
- # clojurebridge (2)
- # clojurescript (128)
- # cryogen (2)
- # cursive (20)
- # datomic (27)
- # emacs (6)
- # events (8)
- # figwheel-main (57)
- # fulcro (46)
- # hoplon (3)
- # hyperfiddle (2)
- # immutant (3)
- # jobs (6)
- # jobs-discuss (15)
- # juxt (2)
- # off-topic (33)
- # parinfer (2)
- # portkey (4)
- # protorepl (1)
- # re-frame (4)
- # reagent (78)
- # ring-swagger (45)
- # schema (6)
- # shadow-cljs (167)
- # spacemacs (2)
- # specter (13)
- # tools-deps (6)
what does this mean in practical terms? I cannot use set!
on goog-define
?
Closure compilation failed with 4 errors
--- registry/aws_test.cljs:16
@define variable registry.PROVIDER assignment must be global
yes, however sometimes you want to use it in your tests
I have seen the pattern used in the wild as well
they are constants with special treatment by the compiler so closure will really not like you messing with them
uhm ok, yeah but I'd have to split my conf for each and every value of it then...I found that vanilla cljs allows this, I frankly don't know why, maybe older GCC...in any case for now it is ok
maybe I should just use a :^dynamic
var containing a goog-define
for this...still deciding
well then you lose all the benefit of a goog-define in the first place. I don't know what you are trying to do in the first place but registry.PROVIDER
looks like it is actually a runtime configuration option and not a compile time constant.
at the beginning it was, I still need to make it so by using the shadow's conditional reader features but it is not a prio so I will convert it to ^:dynamic
for this iteration
[edit] Ok, at https://github.com/binaryage/cljs-devtools/blob/master/docs/faq.md#what-is-the-hints-feature I finally noticed that I can enter, at the REPL: (devtools.core/install! [:formatters :hints]) Also, to make the documentation better, it should be explained exactly where the following configuration is written: :external-config { :devtools/config { :features-to-install [:formatters :hints] :fn-symbol “F” :print-config-overrides true}} I assume it’s written in cljs-build configuration. I’m using shadow-cjls, not cljs-build. -------------------------------------------------------------------------------- I’m using Cursive and running this command from an IntelliJ terminal: lein with-profile +dev-cljs run -m shadow.cljs.devtools.cli watch :app …so when my web page loads, I see: Installing CLJS DevTools 0.9.10 and enabling features :formatters (with :hints and :async greyed out - the latter two weren’t loaded). How can configure project.clj or shadow-cljs.edn - or employ some other tactic - so that I can activate the :hints functionality of CLJS DevTools, i.e., DevTools? (PS, here is relevant portion of project.clj :profiles {:dev-cljs {:dependencies [[binaryage/devtools “0.9.10"] [thheller/shadow-cljs “2.5.1”]]}} and here is shadow-cljs.edn {:source-paths [“src”] :nrepl {:port 3333} :lein {:profile “+dev-cljs”} :builds {:app {:target :browser :output-dir “public/js” :asset-path “/js” :modules {:main {:entries [giggin.core]}} :devtools {:after-load giggin.core/main :http-root “public” :http-port 3000}}}}
:app {... :compiler-options {:devtools/config {:features-to-install ...}}}
I believe
I am trying to make it work with this example https://github.com/ahonn/shadow-electron-starter.
Config
;; shadow-cljs configuration
{:source-paths ["src"]
:dependencies [[reagent "0.8.0-alpha2"]
[cider/cider-nrepl "0.18.0-SNAPSHOT"]]
:builds {:main {:target :node-script
:output-to "resources/main.js"
:main app.main.core/main}
:renderer {:target :browser
:output-dir "resources/public/js"
:asset-path "js"
:modules {:renderer {:init-fn app.renderer.core/start!}}
:devtools {:after-load app.renderer.core/start!
:watch-dir "resources/public"}}}}
There is a library for that https://github.com/Quramy/electron-connect but as I know it reloads everything not just css
hmm it has trouble with the file://
urls electron returns for document.location.href
so i’m trying to run karma, to test my outputted js files
those dependencies that are not found are in the “dependencies” key in package.json , and i’ve npm install’d
if (util && util.inspect && util.inspect.custom) {
module.exports.prototype[util.inspect.custom] = function () {
var obj = util.inspect({ length: this.length });
return this.constructor.name + ' ' + obj;
};
}
any reason why that would fail?
even after an explicit npm install
it still does not work
which code? mine? i.e is this something i can fix?
poo. well i’m using that to resolve stream
:resolve {"object.assign" {:target :npm :require "object-assign"}
"stream" {:target :npm :require "readable-stream"}}
so could maybe try remove that?
if i dont:
[:ci] Compiling ...
symbol module$node_modules$object_assign$index already provided by [:shadow.build.npm/resource "node_modules/object-assign/index.js"], conflict with [:shadow.build.npm/resource "node_modules/object.assign/index.js"]
{:provide module$node_modules$object_assign$index, :conflict [:shadow.build.npm/resource "node_modules/object-assign/index.js"], :resource-id [:shadow.build.npm/resource "node_modules/object.assign/index.js"]}
ExceptionInfo: symbol module$node_modules$object_assign$index already provided by [:shadow.build.npm/resource "node_modules/object-assign/index.js"], conflict with [:shadow.build.npm/resource "node_modules/object.assign/index.js"]
clojure.core/ex-info (core.clj:4739)
clojure.core/ex-info (core.clj:4739)
oh right
okay let me try that
https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/build/npm.clj#L288
oh haha
The required JS dependency "readable-stream/writable.js" is not available, it was required by "node_modules/stream-browserify/index.js".
Searched in:/Users/chrisetheridge/code/Cognician/Monolith/node_modules
You probably need to run:
npm install readable-stream/writable.js
trying the readable-stream/writable.js
. but i’ve installed readable
and stream
yeah that repo doesn’t exist (writable.js)
ill clean node modules
all of those should be ... wait ... do you have shadow-cljs and a dependency in your package.json?
trying that now
➜ Monolith git:(shadow-cljs) ✗ shadow compile ci --debug
shadow-cljs - config: /Users/chrisetheridge/code/Cognician/Monolith/shadow-cljs.edn cli version: 2.5.1 node: v10.8.0
shadow-cljs - starting 2.5.1 with launcher 2.1.0 ...
[:ci] Compiling ...
The required JS dependency "readable-stream/readable.js" is not available, it was required by "node_modules/stream-browserify/index.js".
Searched in:/Users/chrisetheridge/code/Cognician/Monolith/node_modules
You probably need to run:
npm install readable-stream/readable.js
See:
➜ Monolith git:(shadow-cljs) ✗
no it doesn’t
nah definitely in the right dire
lol doing that now as a try
ah that worked!
package-lock was out of sync i guess
does that happen often?
[:ci] Compiling ...
The required JS dependency "react-dom/test-utils" is not available, it was required by "node_modules/enzyme-adapter-react-15/build/ReactFifteenAdapter.js".
Searched in:/Users/chrisetheridge/code/Cognician/Monolith/node_modules
You probably need to run:
npm install react-dom/test-utils
i’m guessing i need to add a :resolve
key for this?check /Users/chrisetheridge/code/Cognician/Monolith/node_modules
+ react-dom/test-utils
ah okay. let me check that
i’ve installed react-dom
yeah that’s most probably the reason. going to see if i can bump it
oh i can use 16
probably don't have to bump to the latest react. just something more recent from the 15.x branch
yeah that worked 🙂 thank you
is it possible to use a runner ns with karma?
if i use a runner ns, i get init is not defined
➜ Monolith git:(shadow-cljs) ✗ karma start --single-run
17 08 2018 12:38:56.254:INFO [karma]: Karma v2.0.5 server started at
17 08 2018 12:38:56.259:INFO [launcher]: Launching browser ChromeHeadless with unlimited concurrency
17 08 2018 12:38:56.267:INFO [launcher]: Starting browser ChromeHeadless
17 08 2018 12:38:56.619:INFO [HeadlessChrome 0.0.0 (Mac OS X 10.13.6)]: Connected on socket B0WRKA9GuQOl0l4wAAAA with id 88087934
HeadlessChrome 0.0.0 (Mac OS X 10.13.6) ERROR
{
"message": "Uncaught TypeError: Cannot read property 'init' of undefined\nat : Cannot read property 'init' of undefined\n at eval (eval at <anonymous> (/Users/chrisetheridge/code/Cognician/Monolith/node_modules/karma-cljs-test/adapter.js:6:7), <anonymous>:1:19)\n at ContextKarma.start (/Users/chrisetheridge/code/Cognician/Monolith/node_modules/karma-cljs-test/adapter.js:6:7)\n at ContextKarma.loaded ()\n at ",
"str": "Uncaught TypeError: Cannot read property 'init' of undefined\nat : Cannot read property 'init' of undefined\n at eval (eval at <anonymous> (/Users/chrisetheridge/code/Cognician/Monolith/node_modules/karma-cljs-test/adapter.js:6:7), <anonymous>:1:19)\n at ContextKarma.start (/Users/chrisetheridge/code/Cognician/Monolith/node_modules/karma-cljs-test/adapter.js:6:7)\n at ContextKarma.loaded ()\n at "
}
can you not use a custom one?
with karma
ah of course. it hooks into shadows one
doh thanks dude
[0:0]~cljs.user=> (require '["enzyme-adapter-react-16" :as Adapter])
[:result {:type :repl/error, :ex #error {
:cause "symbol module$node_modules$object_assign$index already provided by [:shadow.build.npm/resource \"node_modules/object.assign/index.js\"], conflict with [:shadow.build.npm/resource \"node_modules/object-assign/index.js\"]"
:data {:provide module$node_modules$object_assign$index, :conflict [:shadow.build.npm/resource "node_modules/object.assign/index.js"], :resource-id [:shadow.build.npm/resource "node_modules/object-assign/index.js"]}
:via
[{:type clojure.lang.ExceptionInfo
:message "symbol module$node_modules$object_assign$index already provided by [:shadow.build.npm/resource \"node_modules/object.assign/index.js\"], conflict with [:shadow.build.npm/resource \"node_modules/object-assign/index.js\"]"
:data {:provide module$node_modules$object_assign$index, :conflict [:shadow.build.npm/resource "node_modules/object.assign/index.js"], :resource-id [:shadow.build.npm/resource "node_modules/object-assign/index.js"]}
:at [clojure.core$ex_info invokeStatic "core.clj" 4739]}]
i get this when trying to require that npm dep? regardless of :as
or :refer
in a shadow-cljs browser-repl
nvm. hit this before. i was on the wrong build
hmm i still cannot require this module properly
["enzyme-adapter-react-16" :default Adapter]
regardless of :default
:refer
or :as
, i get undefined each time
i get no error message. printing the required object gives me undefined
that was in the browser repl. i wanted to debug the require from there. but dropped that cause of the resolution errors
Fix for loading files with absolute paths in electron. With this live reloading will work.
@endenwer I can fix the live reload, its just getting confused because of the file:
url since I didn't expect that it just assumes http semantics currently.
This is from https://github.com/electron/electron/issues/2242. I din't find another way to fix live reloading
@henrik try running shadow-cljs stop
and then shadow-cljs server
. it probably fails on startup.
may be related to the new launcher though. I'm currently reworking that again to fix a few things
henrik@Mimir-2 ~/D/P/P/i/a/.shadow-cljs> cat server.stderr.log
Error: Unable to access jarfile null
Error: Unable to access jarfile null
Error: Unable to access jarfile null
Error: Unable to access jarfile null
Error: Unable to access jarfile null
Error: Unable to access jarfile null
Error: Unable to access jarfile null
Error: Unable to access jarfile null
Error: Unable to access jarfile null
Error: Unable to access jarfile null
Aug 17, 2018 6:28:11 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Aug 17, 2018 6:28:11 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
shadow-cljs - HTTP server for :client available at
what's the recommended way to serve non-js dependencies from npm (e.g., the css file for katex)? I am hoping there is something better than webjars or symlinks into the node_modules directory
I would appreciate some 👀 on https://github.com/shadow-cljs/lein-template/pull/4
I'm off to lunch right now, but I'll be back in a couple hours.
Is it possible to increase --max-old-space-size
(the max heap size) via the package.json
(reference: https://stackoverflow.com/a/34358130) I'm running out of memory doing some very large batch processing with fs
I.e., can shadow
listen for the start
command in package.json
?
@loganpowell where are you running out of memory?
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
1: node_module_register
2: v8::internal::FatalProcessOutOfMemory
3: v8::internal::FatalProcessOutOfMemory
4: v8::internal::Factory::NewFillerObject
5: v8::internal::wasm::WasmOpcodes::TrapReasonMessage
6: 000002033BF843C1
cli version: 2.4.25
you mean shadow or Node?
yes, node-repl
but it's due to the load I'm putting on Node
Like this?
(shadow.cljs.devtools.api/node-repl {:node-args ["--max-old-space-size=8192"]})
To quit, type: :cljs/quit
=> [:selected :node-repl]
so that's the equivalent of:
"start": "node --max-old-space-size=4076"
sorry with the 8192
in there instead
sweet! Thank you!