Fork me on GitHub
#shadow-cljs
<
2018-05-19
>
wilkerlucio00:05:13

I was sure it was 8 from shadow telling me 😛

thheller00:05:13

I'm on v9.4.0 and 5.6.0

wilkerlucio00:05:33

I did installed the 8 yesterday, not sure why the one from node -v still 6

thheller00:05:07

npm versions differ from the node versions

thheller00:05:24

kinda unrelated since you can update npm independently

wilkerlucio00:05:26

I mean node, installed node 8 yesterday

thheller00:05:29

shadow-cljs only reports the node version

thheller00:05:48

dunno how to get the npm version (running npm -v seems like overkill)

wilkerlucio00:05:36

so the latest npm is the problem

thheller00:05:49

but yeah someone reported the 130 a few days ago. no idea where that comes from but it is not happening in v5

thheller00:05:07

I never explicitely set 130 anywhere

wilkerlucio00:05:10

I only noticed because I wrapped the shadow calls in npm scripts

wilkerlucio00:05:18

then it complains when I stop the compilation

wilkerlucio00:05:54

no big deal, just a minor annoyance

thheller00:05:27

yeah I'll probably have to look into it at some point

thheller00:05:07

if you feel like it open an issue. otherwise I just forget again 😉

wilkerlucio00:05:11

sure 🙂

wilkerlucio00:05:04

the manifest.edn for content-script is working? I tried using it now, but seems like it's generating multiple files (failing on document_start)

thheller00:05:02

it always generates multiple files yes. does that not work with document_start? I tested on idle and that worked.

wilkerlucio00:05:28

no, I got those:

wilkerlucio00:05:30

main.js:3016 GET  0 ()
(anonymous) @ main.js:3016
env.load @ main.js:3009
(anonymous) @ main.js:3054
20:57:00.120 main.js:3016 GET  0 ()
(anonymous) @ main.js:3016
env.load @ main.js:3009
(anonymous) @ main.js:3054
20:57:00.120 main.js:3016 GET  0 ()
(anonymous) @ main.js:3016
env.load @ main.js:3009
(anonymous) @ main.js:3054
20:57:00.121 main.js:3016 GET  0 ()
(anonymous) @ main.js:3016
env.load @ main.js:3009
(anonymous) @ main.js:3054
20:57:00.121 main.js:3016 GET  0 ()
(anonymous) @ main.js:3016
env.load @ main.js:3009
(anonymous) @ main.js:3054
20:57:00.140 main.js:3016 GET  0 ()
(anonymous) @ main.js:3016
env.load @ main.js:3009
(anonymous) @ main.js:3054
20:57:00.140 main.js:3016 GET  0 ()
(anonymous) @ main.js:3016
env.load @ main.js:3009
(anonymous) @ main.js:3054
20:57:00.141 

thheller00:05:13

uhm it should not GET anything? maybe outdated?

wilkerlucio00:05:44

I didn't tried using idle, let me try that just to check if the document_start is really the problem

thheller00:05:01

might just need to reload the extension?

wilkerlucio00:05:16

I tried, but its even loading now

wilkerlucio00:05:19

is this correct?

wilkerlucio00:05:20

:content_scripts         [{:matches ["<all_urls>"]
                            :entry   fulcro.inspect.chrome.content-script.main
                            :run_at  "document_idle"}]

thheller00:05:42

:content-scripts

thheller00:05:59

I can't stand looking at _ in keywords 😛

thheller00:05:13

should probably support both but currently it only supports -

wilkerlucio00:05:29

ok, that's easy at least 😛

wilkerlucio00:05:36

I'm on the - team too

thheller00:05:51

all - will be converted to _ before writing the JSON

thheller00:05:22

so both work already but it currrently only checks :content-scripts not :content_scripts

wilkerlucio00:05:55

now hte compilation seems fine, but it's failing to connect the repl

wilkerlucio00:05:17

is there any other configuration that needs to change?

thheller00:05:33

failing how?

wilkerlucio00:05:40

browser.cljs:310 WebSocket connection to '' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

thheller00:05:51

is the IP correct?

wilkerlucio00:05:14

yes, but I guess it used to work via localhost

wilkerlucio00:05:21

I remember it not working by ip

thheller00:05:58

the usual :devtools {:devtools-url ""} might work?

thheller00:05:06

which IP did shadow-cljs display on server startup?

thheller00:05:24

it might be picking an incorrect IP

thheller00:05:51

thats a different IP? but the public address is your internet address. thats likely incorrect.

wilkerlucio00:05:58

but for some reason seems not connecting, I'm using the company macbook, it might have firewall or something setup (I did the setup long ago, don't remember)

wilkerlucio00:05:04

the public ip is for the building here

wilkerlucio00:05:09

it's using my local ip

thheller00:05:13

ah didn't see the other one

thheller00:05:49

can you go to ?

wilkerlucio00:05:15

192.168.0.121 refused to connect.

thheller00:05:22

but localhost:9630 works?

thheller00:05:09

its supposed to bind to 0.0.0.0 so the IP should work

thheller00:05:12

do you have multiple IPs?

wilkerlucio00:05:22

not that I know

wilkerlucio00:05:26

0.0.0.0 works too

wilkerlucio00:05:25

I tried to force 192.168.0.121 into my /etc/hosts, but that doesn't seem to work either

wilkerlucio00:05:59

that was just wrong, no sense 😛

thheller00:05:06

did your IP maybe change since the server was started?

thheller00:05:23

wlan up/down that sort of stuff?

wilkerlucio00:05:30

I did disconnected from a VPN during the middle, I'm restarting to try again

wilkerlucio00:05:48

restarted server, same thing

thheller00:05:00

oh VPN. maybe it picked your VPN adapter

thheller00:05:33

forgot what the command was for osx. ifconfig maybe?

thheller00:05:39

check which adapters you have

wilkerlucio00:05:00

en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	ether a4:5e:60:d9:ad:3b
	inet 192.168.0.121 netmask 0xffffff00 broadcast 192.168.0.255
	media: autoselect
	status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
	ether 06:5e:60:d9:ad:3b
	media: autoselect
	status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
	ether 1a:77:42:f7:ca:78
	inet6 fe80::1877:42ff:fef7:ca78%awdl0 prefixlen 64 scopeid 0x8
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=60<TSO4,TSO6>
	ether 6a:00:00:34:ba:00
	media: autoselect <full-duplex>
	status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=60<TSO4,TSO6>
	ether 6a:00:00:34:ba:01
	media: autoselect <full-duplex>
	status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=63<RXCSUM,TXCSUM,TSO4,TSO6>
	ether 6a:00:00:34:ba:00
	Configuration:
		id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
		maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
		root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
		ipfilter disabled flags 0x2
	member: en1 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 9 priority 0 path cost 0
	member: en2 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 10 priority 0 path cost 0
	media: <unknown type>
	status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
	inet6 fe80::8ea2:2eee:6e4c:561e%utun0 prefixlen 64 scopeid 0xe
	nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::d746:7a38:7b:f32%utun1 prefixlen 64 scopeid 0xf
	nd6 options=201<PERFORMNUD,DAD>
utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::bdc0:d124:6bee:608b%utun2 prefixlen 64 scopeid 0x10
	nd6 options=201<PERFORMNUD,DAD>
EHC64: flags=0<> mtu 0
en5: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
	ether 40:6c:8f:55:95:d7
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect (none)
	status: inactive
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
	lladdr 00:0a:27:02:00:49:ca:5f
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect <full-duplex>
	status: inactive

thheller00:05:28

hmm ok so it does pick the correct one

thheller00:05:09

no idea why it doesn't work thought. I can connect to which is my machine

thheller00:05:47

I should just remove all the "smart" logic I added since working on the react-native stuff

thheller00:05:58

and just default to localhost again. that had less issues 😛

wilkerlucio00:05:25

hehe, what motivated you to work on figuring the correct ip address?

thheller00:05:34

react-native required it

thheller00:05:15

or rather expo. since I was using my actual phone to test stuff and not an emulator. so localhost didn't work

wilkerlucio00:05:33

oh true, would be nice to keep that for RN stuff

wilkerlucio00:05:45

and now that you said so, I did RN with shadow, and it worked then

wilkerlucio00:05:54

I'll try restarting here

wilkerlucio00:05:01

maybe it screws up after a VPN connection

thheller00:05:56

browsers can just use document.location so its easier there but that breaks for chrome exts

wilkerlucio00:05:05

no, still not work

wilkerlucio00:05:40

I clicked on the shadow link thinking it was the ip (that was above :P)

thheller00:05:52

open an issue please. too tired to figure out what to do 😛

thheller00:05:00

:devtools-url should fix it

thheller00:05:15

but I'd prefer the default to work properly

wilkerlucio00:05:56

and :devtools-url works fine

thheller00:05:35

I'm off to bed, gn8

wilkerlucio00:05:30

good night, thanks again, and just to wrap up, document_start works fine

gnl17:05:37

Can the :before-load hook prevent reloading by returning false or something like that?

gnl17:05:40

...or rather - could it?

borkdude18:05:04

I’m trying to use Reagent in a node project to render some HTML statically. This is my config:

{:source-paths ["src"]
 :dependencies [[reagent "0.8.1"]]
 :builds {:app {:target :node-script
                :output-to "target/main.js"
                :main server.main/main!
                :devtools {:after-load server.main/reload!}}}}
This is my require:
(ns server.main
  (:require [reagent.dom.server :refer [render-to-static-markup
                                        render-to-string]]))

borkdude18:05:34

The error I get:

The required namespace "react" is not available, it was required by "reagent/impl/template.cljs".
although I see react listed in the dependencies of Reagent?

borkdude19:05:11

I’ve solved it by adding react and react-dom via npm

borkdude20:05:28

How do I get shadow-cljs to output a single .js file that I can use without additional libraries?

borkdude20:05:10

e.g. now I get

$ /tmp/html.js
internal/modules/cjs/loader.js:573
    throw err;
    ^

Error: Cannot find module 'react-dom/server'
while it works in the project directory

thheller20:05:23

@borkdude node packages are not bundled. since that is not usually how its down for node. typically you'd compile to some directory and put a package.json there with the dependencies you need

thheller20:05:28

you then npm install it and run it

thheller20:05:55

@clojurians.net no there is currently no "recommended" way to abort a reload. why would you want to?

kenny22:05:30

I kept getting this printed to the console when trying to run my tests:

shadow-cljs - config: /Users/kenny/compute_software/clake/cli/shadow-cljs.edn version: 2.3.21
shadow-cljs - starting via "clojure"
[2018-05-19 15:10:33 - WARNING] failed to inspect resource "/Users/kenny/compute_software/clake/cli/test/clake_cli/core_test.cljs", it will not be available.
[:test] Compiling ...
========= Running Tests =======================

Ran 0 tests containing 0 assertions.
0 failures, 0 errors.
===============================================
[:test] Build completed. (26 files, 0 compiled, 0 warnings, 1.98s)
... and could not figure out what was wrong. I had a pretty vanilla test file:
(ns clake-cli.core-test
  (:require [cljs.test :refer :all]))

(deftest my-test
  (is (= 1 1)))
Turns out I forgot :refer :all isn't support in CLJS which caused that issue. I suggest make the error message more clear for this case (especially because that is the default file Cursive generates for CLJS tests).