Closed xenoterracide closed 4 years ago
You are not supposed to put relative path inside <base>
. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
What you have is different issue I think.
https://github.com/ionic-team/capacitor/issues/1037 I'm open to alternative fixes, since I've provided reproduction steps, but what is currently there does not work
I think I am wrong about <base>
.
The base URL to be used throughout the document for relative URLs. Absolute and relative URLs are allowed.
But in Aurelia, we have to use absolute path inside <base>
to support routes.
Because inside a front-end route http://localhost/product/1
, <base href="./">
does not work for us.
If the app and unit tests and cypress tests all work as expected, I guess this repo might not correct place to fix your electron setup. But I have no much experience on electron anyway, I might be wrong.
The <base href="./">
is not a fix. As I said, it will break Aurelia app with pushState routes, unless @jwx did something different from Aurelia 1.
pushState (if I understand you correctly) does not work in electron see https://github.com/aurelia/aurelia/issues/852
But we cannot use your fix because this repo is mainly to support Aurelia app (majority of users will use router), not electron.
Since you knew why to make your setup work, you can mutate the app after it was generated. I guess simply remove <base>
element will work for you too.
I'm using router, currently it seems fine, but maybe I don't have the right thing done, I don't have a route like product/1
for example. I see someone also suggesting ''
maybe that is the better fix. I'll try it.
My app needs to support ALL of the platforms and things like product/1
will need to work in all of them.
My example is for when use click a menu to <a href="another/page">
from /product/1
page, the <base href="./">
will tell browser to route to /product/another/page
(or /product/1/another/page
I am not sure), not /another/page
(<base href="/">
will give that correct result).
You need to test your other base fix for the above case.
<base href="">
works too, if that's any better
we can leave this open for now, @jwx has some insight here as well... all I really have right now is that href="/"
causes issues other SPA platforms
curious, what happens if you serve an app root at http://localhost/foo
and you're using /
will that still work correctly?
I tested <base href="">
in au1, it broke the reload if I reload a page with some route /not/root
, it might be due to I use lots of bare url resources link in my app.
Let's follow up this issue in the aurelia/aurelia#852, might be an opportunity to remove <base>
from au2's router requirement. Actually I never heard about <base>
tag before using Aurelia.
I don't actually think that's the right place to discuss this as it confuses the issue, since there are 2 separate issues. In discord I got this from @jwx
Jurgen: Right. So 1) the au2 router doesn't use
so that can safely be removed
and doing that works for me
To be clear: the router in Aurelia 2 doesn't use or require the <base>
tag.
Great! Let's just remove it!
instead of
<base href="/" />
it needs to be<base href="./" />
otherwise you'll get this.to reproduce
you will see a black screen of death and in the console there will be the afformentioned error