Fork me on GitHub
#shadow-cljs
<
2019-05-16
>
andreortiz02:05:32

Anyone have any issues deploying to heroku? I have a test project here: https://github.com/andreortiz82/middlemancljs It continues to crash due this error Executable 'java' not found on system path.. I’ve added the heroku/[ruby nodejs java] buildpacks but I’m still missing the proper incantations. Anyone else run into this? Any resources or tips would be much appreciated. Thank you! πŸ‘

attentive07:05:59

I really love Shadow-CLJS, but find I'm still having an issue getting the CLJS repl to function the way that I want for the :react-native target …

attentive07:05:34

At the moment when I run rlwrap shadow-cljs cljs-repl app to connect to my app (running under react-native android alongside the Metro bundler I get a mysterious websocket error message. I feel like this wasn't always happening but remain unsure on the cause.

thheller07:05:03

@attentive shadow-cljs can pick the wrong IP so the REPL client may fail to connect to the actual shadow-cljs instance.

thheller07:05:19

try running shadow-cljs watch app --verbose and it'll tell you which IP it used

attentive07:05:29

Yes … I've got a more minimal instance of an issue now that's still perplexing me

attentive07:05:41

I'm pretty sure we've been over this once before so forgive my confusion

thheller07:05:44

you can configure the IP to use via shadow-cljs watch app --config-merge '{:local-ip "123.123.123.123"}' or :local-ip ... directly in the build config

thheller07:05:03

or what is that mysterious websocket error message?

attentive07:05:37

Okay I seem to have two separate, and unrelated issues. The issue with guessing the IP might be affecting my main project, but on this minimal version of your Expo example with Expo removed, I get "no source by provide: " exception info once the REPL appears to have connected.

thheller07:05:39

please never abbreviate error messages

thheller07:05:47

post the full thing if you can πŸ™‚

attentive07:05:53

yarn run v1.12.3
$ rlwrap shadow-cljs cljs-repl app
shadow-cljs - config: /home/tom/dev/trm/rn-rf-shadow/shadow-cljs.edn  cli version: 2.8.8  node: v8.15.0
shadow-cljs - connected to server
[4:1]~scout.dev-preloads=> (foo)
[:result {:type :repl/error, :ex #error {
 :cause "no source by provide: scout.dev-preloads"
 :data {:provide scout.dev-preloads}
 :via
 [{:type clojure.lang.ExceptionInfo
   :message "no source by provide: scout.dev-preloads"
   :data {:provide scout.dev-preloads}
   :at [shadow.build.data$get_source_id_by_provide invokeStatic "data.clj" 182]}]
 :trace
 [[shadow.build.data$get_source_id_by_provide invokeStatic "data.clj" 182]
  [shadow.build.data$get_source_id_by_provide invoke "data.clj" 179]
  [shadow.build.data$get_source_by_provide invokeStatic "data.clj" 185]
  [shadow.build.data$get_source_by_provide invoke "data.clj" 184]
  [shadow.cljs.repl$process_read_result$fn__12538$fn__12539 invoke "repl.clj" 431]
  [shadow.cljs.repl$process_read_result$fn__12538 invoke "repl.clj" 407]
  [shadow.cljs.repl$process_read_result invokeStatic "repl.clj" 405]
  [shadow.cljs.repl$process_read_result invoke "repl.clj" 381]
  [shadow.cljs.devtools.server.worker.impl$fn__13210 invokeStatic "impl.clj" 784]
  [shadow.cljs.devtools.server.worker.impl$fn__13210 invoke "impl.clj" 745]
  [clojure.lang.MultiFn invoke "MultiFn.java" 234]
  [shadow.cljs.devtools.server.util$server_thread$fn__12888$fn__12889$fn__12897 invoke "util.clj" 292]
  [shadow.cljs.devtools.server.util$server_thread$fn__12888$fn__12889 invoke "util.clj" 291]
  [shadow.cljs.devtools.server.util$server_thread$fn__12888 invoke "util.clj" 264]
  [clojure.lang.AFn run "AFn.java" 22]
  [java.lang.Thread run "Thread.java" 748]]}}]
[4:1]~scout.dev-preloads=> 

thheller07:05:20

ok I'm assuming you have set :repl-init-ns scout.dev-preloads whithout repeating said ns into the :preloads?

attentive07:05:48

No, I've got both set (but will remove and check now)

thheller07:05:12

oh right ... :preloads doesn't currently work for :react-native

thheller07:05:26

I'm pushing a release that takes care of that in a few minutes

πŸ˜› 4
attentive07:05:48

Thank you πŸ˜„

attentive07:05:16

For what it's worth, the repo I'm working with is here https://github.com/Trailmarker/rn-rf-shadow, it's a modified version of the Expo / re-frame example that was created by @pez …

thheller07:05:44

@attentive try [email protected]. that should fix the :preloads related REPL issue

πŸŽ‰ 4
attentive07:05:56

Nice, thank you

attentive08:05:45

Okay, getting some joy here, thanks! I've now got scout.dev-preloads in both :repl-init-ns and :preloads, and after restoring it to the :preloads vector I can execute (foo 1 2) correctly from that namespace after the REPL connects. This looks very promising.

attentive08:05:36

I've pushed the repo above with the changes that brought me to a working state

attentive08:05:57

Cheers once again for your support @thheller

pez12:05:46

@attentive if you think my project should be updated with the same I'd welcome a PR.

4
attentive12:05:53

I'll take a look back at it, just jumping back on now to see if I can get this all working with my private repo

hlolli12:05:22

@thheller I'm experimenting with haul and react-native for sourcemaps, which uses webpack, I'm looking into the source-map-loader, and it seems it calls fs.readFile according to a regex of the source map url at the bottom. The problem seems to me, I could be wrong, that the source map url doesn't include the file path, to the directory, only the name of the sourcemap file without path to it. Could I add that to the js output from shadow side?

Jeff Dierckman12:05:35

I work in a corporate environment where they have recently blocked all access to external repo managers like maven, npm, etc. and have instead set up an internal Nexus repo that we are to use. I can add a .npmrc file in my project to set the repo for npm to use, but I could not figure out how to set the repository that shadow itself uses to pull down its dependencies. Any suggestions?

hlolli13:05:47

@jeff.dierckman use tools.deps for dependency resolution and add the repository from there?

Jeff Dierckman13:05:06

@hlolli thanks. I'll give that a shot.

thheller13:05:13

@hlolli I'm not sure what you are asking? the source map doesn't require any other external files

thheller13:05:21

its all included in the sourcesContent array

thheller13:05:13

@jeff.dierckman you can control maven related settings via :maven {:repositories {...}} in shadow-cljs.edn

hlolli13:05:15

like this here //# sourceMappingURL=app.components.button.js.map I'd want it to be //# sourceMappingURL=build/app.components.button.js.map or smth, maybe it doesn't make sense?

thheller13:05:48

sourceMappingURL is a relative path

thheller13:05:03

so app.components.button.js.map is in the same directly as app.components.button.js

thheller13:05:16

not sure what build/ is?

hlolli13:05:29

yes, I'm wondering if webpack is noticing that, build/ would be the path from the root directory of the project

thheller13:05:44

the resolve rules for sourceMappingURL are quite simple to webpack should find it properly

thheller13:05:48

how does haul work with metro?

thheller13:05:56

or is it a complete replacement?

hlolli13:05:02

it works great! btw, no need for the updateRoot hack

hlolli13:05:07

forceUpdate I mean

hlolli13:05:28

but it's bit unstable, had to use next directly from their github to make it work, so soon it will get more stable

hlolli13:05:52

I was fighting metro all day long yesterday, got sick of it.

thheller13:05:11

yeah its no fun πŸ˜›

hlolli13:05:15

they transform the js and then concatinate into a huge file, and trying to keep sync of the source maps is hell

hlolli13:05:31

I was trying to parse the source maps and recalculate the new positions, gave up

thheller13:05:09

and what is the issue with the source maps in particular?

hlolli13:05:49

no, they work fine, they just source map the js output, but it's fully debuggable, so I'm just tryign to get source mapping to the cljs sources

thheller13:05:06

yes and what is the issue with that?

thheller13:05:13

error? stack trace?

hlolli13:05:32

right now, with Haul, it's source mapping the js output, ignoring the .map files from shadow

hlolli13:05:43

so I'm just console logging the source-map-loader

thheller13:05:50

so they are loaded?

hlolli13:05:01

I think not, I think it resolves without source maps, but I'll investigate further so I'm sure about it, all I can say that this res callback from info https://github.com/webpack-contrib/source-map-loader/blob/master/index.js#L97 is never called, but regex match 2 finds the the sourcemapurl, so something in between is failing

thheller13:05:22

uhm I don't think that code would ever be called?

thheller13:05:40

async.map(missingSources, there should never be missing sources?

thheller13:05:03

the entire if should be skipped

thheller13:05:24

log the map there?

hlolli13:05:23

I can post, but it logs many source maps

hlolli13:05:12

a source map of sources, mappings, (basically all the .map files I have)

hlolli13:05:34

which means it should load πŸ™‚

hlolli13:05:22

probably a question of setting the right "devtool" option

thheller13:05:11

I can't remember if I ever got source-map-loader working before

hlolli13:05:31

your webpack example includes it

thheller13:05:13

that doesn't mean it actually worked

thheller13:05:40

it was also 2 years ago which is like 10 generations in js land

thheller13:05:48

doesn't mean it still works that way πŸ˜›

hlolli13:05:03

yes, I'm now just getting webpack_require__ and namespace.file.js in my source maps

hlolli13:05:16

must be some devtools option.. try them all πŸ™‚

thheller13:05:18

what does haul do exactly? how does it skip metro?

hlolli13:05:58

it creates a server, bundles, compiles

hlolli13:05:06

detects simulator/emulators

thheller13:05:20

I mean react-native/metro has some kind of custom source map format

thheller13:05:29

how is that supported by haul?

hlolli13:05:34

I don't think they support it, if they use metro at all, then it's the last step. They claim that symlink between files work, maybe eliding the need for a single bundle? Not sure.

thheller13:05:31

I don't really have time to dive into this now but if you figure out how to tell the native app which JS to load we can do all of this without metro properly

hlolli13:05:33

no that's different reason

thheller13:05:46

but I couldn't find a way without losing pretty much all features

hlolli13:05:32

yes, it's a dirty buisness this react-native

thheller13:05:48

I only tried emulating what expo did there and that already proved not worth it in the end

hlolli13:05:14

I already ruled out expo long ago, makes no sense to be ejected, nothing that expo gives me that pure metro/shadow can't give me.

hlolli13:05:30

It works well as soon as you need native modules πŸ™‚

thheller13:05:35

disregard expo it is not relevant

thheller13:05:47

I meant to say that I already tried bypassing metro before

thheller13:05:56

and it didn't work out too well in the end

hlolli13:05:04

I see, does expo bypass metro? I thought they were togeather

thheller13:05:12

no its built on top of metro

thheller13:05:38

but what that did is running metro standalone as a single command

thheller13:05:48

and shadow-cljs would then generate that into its output

thheller13:05:57

instead of the other way

thheller13:05:05

so shadow-cljs was in control of source maps and that worked fine

thheller13:05:31

expo was only relevant since it allowed a way to "hack" which .js file was loaded by the runtime

thheller13:05:04

but in the end the extra features provided by the metro development server

thheller13:05:38

weren't easy to replicate so I didn't pursue that direction any further

Chase16:05:18

my apologies for crossposting but I'm not sure if I'm having a cider issue or a shadow-cljs issue: when trying to run and connect to a shadow-cljs app I'm getting a ton of nrepl middleware warnings and then get errors when trying to connect to the repl (using cider/cider-nrepl and cider/piggieback with vim fireplace). https://pastebin.com/se1cJESJ This was working a few weeks ago but I'm on a fresh install so don't know what has changed. any clues? this is the error message I get when trying to connect: https://pastebin.com/ZueFshz0 relevant portion of shadow-cljs.edn:

:dependencies [[binaryage/devtools "0.9.10"]                                                  
                [cider/cider-nrepl "0.21.1"]                                                   
                [cider/piggieback "0.4.1"]                                                     
                [reagent "0.8.0"]]

thheller16:05:50

piggiback isn't required and won't do anything

Chase16:05:47

interesting. I've always had to do :Piggieback :app to get my vim-fireplace repl connection switched to cljs

thheller16:05:20

that is unrelated (and will continue to work)

thheller16:05:05

the error however looks like some older version of nrepl is used?

thheller16:05:33

which shadow-cljs version is that using?

Chase16:05:20

shadow-cljs - config: /home/chaselambert/projects/learn-reagent-course-files/giggin/shadow-cljs.edn cli version: 2.3.30 node: v12.2.0

Chase16:05:44

i took out piggieback dependency but no change in error behavior

thheller16:05:59

yeah you need to update shadow-cljs

Chase16:05:28

globally or within that project? might be a dumb question

thheller16:05:01

global never matters since the version in the project is always used. so in the project πŸ˜‰

Chase16:05:58

and we are back up and running! thank you so much! I'll let the tutorial author know about that old shadow-cljs dependency

martinklepsch21:05:49

Hey πŸ™‚ I'm getting The required namespace "cljsjs.prop-types" is not available, I think last times this has been fixed by just installing the appropriate npm package but the error sticks around

martinklepsch21:05:05

I checked that shadow-cljsjs handles prop-types which it seems to do

martinklepsch21:05:21

oh but wait, just seeing that that change is only 8 days old

martinklepsch21:05:07

updating and I guess that will be it πŸ™‚