Fork me on GitHub
#figwheel
<
2018-11-24
>
bhauman15:11:46

@jsa-aerial its probably because of the path that you are using for your main.js script

bhauman15:11:57

make sure its absolute and not relative

bhauman15:11:00

i.e <script src="/path/to/main.js"> not <script src="path/to/main.js">"

jsa-aerial18:11:41

@bhauman I tried that but the results are the same. Poking around some more, I see from console log that the server (in Figwheel) expects everything (entire directory structure) to be under a Fig/public directory instead of just the usual public directory. So, nothing in the iindex.html file is found or loaded (including the "main.js" script. I even tried giving the absolute path starting with /public but server still tries loading from Fig/public(?!?).

jsa-aerial18:11:18

OK, I even tried putting absolute and relative resources in front. With /resources/public/path/to/main.js the path is actually that, but the file is not found (maybe because it is really looking for /resources/resources... ??). If it is relative then it ends up being Fig/resources/.... It doesn't look like it is possible to do this with the way Figwheel currently resolves paths.

bhauman19:11:30

@jsa-aerial yes something in your setup is off

bhauman19:11:58

figwheel shouldn’t expect things to be under Fig/public

bhauman19:11:32

shoudn’t

jsa-aerial19:11:16

OK - I don't have any other 'path' stuff configured - maybe there is an option I'm missing?

bhauman19:11:43

can you show me your code in a gist?

bhauman19:11:52

mostly config stuff

bhauman19:11:23

do you have the tree program installed so that I can get a quick look at your directory structure?

jsa-aerial19:11:27

One thing I do know. This project actually is all about setting up a client and server and when I start the projects server (on another port) it can serve the Fig/index.html and correctly serve all the other resources.

jsa-aerial19:11:11

So, it is definitely something about how figwheel is configured or setup.

jsa-aerial19:11:00

Frankly, one 'solution' is to just browse to the projects server address and things simply work. But that's a bit annoying

bhauman19:11:35

why do you need to browse there, that’s what :open-url is for??

jsa-aerial19:11:17

Exactly - except figwheel does not get the resources correct. The project server does

bhauman19:11:10

@jsa-aerial does figwheel work when you are using the project server?

jsa-aerial19:11:09

So, to be explicit this (which opens automatically) gets the resources wrong, but this gets the resources correct.

jsa-aerial19:11:50

That's because it correctly serves up the 'main.js' script

bhauman19:11:02

and you can now have :open-url ""

jsa-aerial19:11:33

OK - that sounds like a plausible solution - didn't know that

jsa-aerial19:11:05

Maybe there is something else wrong - I have :open-urls as the key (note ending 's'). Is that wrong? I got this from a template

bhauman19:11:51

Are you using lein-figwheel ?

bhauman19:11:02

sorry I thought you were using figwheel-main.

bhauman19:11:17

for lein-figwheel :open-urls is correct

jsa-aerial19:11:10

I'm pretty sure I'm using figwheel-main. Well, I start by getting a repl (just lein repl) and then issue (use 'figwheel-sidecar.repl-api) and then (start-figwheel!)

bhauman19:11:25

no that is not figwheel-main

bhauman19:11:53

you should be using :open-urls

jsa-aerial19:11:09

OK. I also have this for dev profile:

jsa-aerial19:11:46

OK, yes, I am using lein-figwheel: [lein-figwheel "0.5.16"]

jsa-aerial19:11:16

Which only goes to show how little I understand about how this is all plumbed...

bhauman19:11:50

have you tried putting the locahost:3003 url in :open-urls?

jsa-aerial19:11:03

Pretty much just following a 'cookbook recipe'

jsa-aerial19:11:14

Let me try that

jsa-aerial19:11:06

Yes, just plain works

jsa-aerial19:11:34

And figwheel is still opening up port localhost:3449 - and if you browse there still serves up wrong paths. Shrug.

jsa-aerial19:11:08

Since I always have the project server start (and in testing always use 3003) I can just use :open-urls with that address and things will just work. Still, seems odd that the server at 3449 doesn't get this right. One thing the project server also does is set the resources route to "/": (route/resources "/"). Maybe figwheel doesn't do that?