Ofcourse, the js file is not found, and nothing loads on the screen.
I have no control over this, because the script tag which loads the webpack bundle is injected into the index.html file. Else I would have changed it to an absolute path.
Xavier Via
@xaviervia
:D I think I should try it out to understand. I'm not sure if it could be a router weirdness or a sagui config. In principle it is unlikely that it is a sagui config because it's fairly standard webpack config, but of course it's super possible
If you want to try you can make it an absolute path. I haven't tried this myself, but you can set your js file to be built as a lib in sagui.config.js
Karthik Iyengar
@karthikiyengar
I am skeptical about it being something related to Sagui myself, because this is pretty standard stuff that everyone might be using.
Someone must have encountered it before me.
Xavier Via
@xaviervia
And then you can set it to build to umd so you can load it with a script tag
Well, if this is related to Sagui, I do you think that the absolute path from which assets are served should be configurable? Because mounting the app on non root (/) locations is pretty common.
Thanks Xavier, I'll take a look :D
Xavier Via
@xaviervia
Makes a lot of sense
Karthik Iyengar
@karthikiyengar
If your static assets are not coming from root, you're pretty much stuck (if you don't want to jump through hoops)
Thank you for your help, much appreciated. I will let you know how this ends lol.
Xavier Via
@xaviervia
saguijs/sagui#269
Sure thing, hope it works out :)
Karthik Iyengar
@karthikiyengar
Btw, create-react-app is doing this by using a property called "homepage" in package.json.
Might work for Sagui, if you feel that it's right.
Xavier Via
@xaviervia
For sure. We tried to keep the config minimalistic. I'll try to check if there is an underlying issue, maybe there is a general solution as well so that the config is not needed (it should probably be added anyway)
Karthik Iyengar
@karthikiyengar
That's exactly what I liked about Sagui, moved away from create-react-app today. Had to run eject to get anything done.
Then we were back to square one.
Xavier Via
@xaviervia
:D
Paulo actually talked about that with a lot of people about those issues before coming up with the current approach. Command line solutions didn't cut it for our use cases. I'm glad it's helpful.
Karthik Iyengar
@karthikiyengar
Pretty Interesting.
Okay - I was browsing through some of webpack dev server's docs, and I may be wrong here, but the webpack bundle certainly needs to be served from an absolute path.
I looked the the sagui configs, and I don't see an explicit publicPath set in the config, which means the bundle will always be generated at /
This would ideally break router.
Again - I find it hard to believe that I am the first person to face this with router and Sagui. It is highly possible that this might be something I might have missed.
*needs to be fetched from an absolute path - in index.html
Xavier Via
@xaviervia
It might just not have been reported before.
Karthik Iyengar
@karthikiyengar
Do you want me to open an issue with the details?
Xavier Via
@xaviervia
Could you share a gist with your setup on gh or something like that so I can play around with it later?
Karthik Iyengar
@karthikiyengar
I can also take it up if it is confirmed.
Sure.
Xavier Via
@xaviervia
Yes, even better. Thanks :)
Karthik Iyengar
@karthikiyengar
saguijs/sagui#270
Have provided a quick example.
Xavier Via
@xaviervia
Awesome
It's close to bed time around here so I'll take a look tomorrow, thanks for taking the time to report it :)