@jsa-aerial its probably because of the path that you are using for your main.js script
make sure its absolute and not relative
i.e <script src="/path/to/main.js">
not <script src="path/to/main.js">"
@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
(?!?).
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.
@jsa-aerial yes something in your setup is off
figwheel shouldn’t expect things to be under Fig/public
shoudn’t
OK - I don't have any other 'path' stuff configured - maybe there is an option I'm missing?
can you show me your code in a gist?
mostly config stuff
do you have the tree
program installed so that I can get a quick look at your directory structure?
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.
So, it is definitely something about how figwheel is configured or setup.
Frankly, one 'solution' is to just browse to the projects server address and things simply work. But that's a bit annoying
why do you need to browse there, that’s what :open-url is for??
Exactly - except figwheel does not get the resources correct. The project server does
@jsa-aerial does figwheel work when you are using the project server?
So, to be explicit this <http://localhost:3449/Fig/index.html>
(which opens automatically) gets the resources wrong, but this <http://localhost:3003/>
gets the resources correct.
That's because it correctly serves up the 'main.js' script
and you can now have :open-url "<http://localhost:3003>"
OK - that sounds like a plausible solution - didn't know that
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
Are you using lein-figwheel
?
sorry I thought you were using figwheel-main.
for lein-figwheel :open-urls
is correct
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!)
no that is not figwheel-main
you should be using :open-urls
OK. I also have this for dev profile:
OK, yes, I am using lein-figwheel: [lein-figwheel "0.5.16"]
Which only goes to show how little I understand about how this is all plumbed...
have you tried putting the locahost:3003
url in :open-urls?
Pretty much just following a 'cookbook recipe'
Let me try that
Yes, just plain works
And figwheel is still opening up port localhost:3449 - and if you browse there still serves up wrong paths. Shrug.
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?