Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

basePath not working as expected #1083

Open
Wiering opened this issue Dec 5, 2017 · 1 comment
Open

basePath not working as expected #1083

Wiering opened this issue Dec 5, 2017 · 1 comment

Comments

@Wiering
Copy link

Wiering commented Dec 5, 2017

I'm trying to run this app on a subdirectory on my domain at mydomain.com/polymertest/

So, according to index.html, I add "basePath": "polymertest", to polymer.json, and after building, the code now contains <base href="/polymertest/">

This works partially, the app loads the top and left sidebar, but the content part says: Oops you hit a 404. Head back to home (and home links to mydomain.com instead of mydomain.com/polymertest/).

Now, if I click View One in the menu, it actually works, but the url changes to mydomain.com/view1 which is wrong (the same with View Two and View Three).

Of course, if I go to mydomain.com/view1, the page is not found. But mydomain.com/polymertest/view1 doesn't work either.

@jsilvermist
Copy link
Contributor

jsilvermist commented Dec 5, 2017

I would write it as an absolute path like "/polymertest/", and you should also edit this line.

If you're not using differential serving[1][2], you can use basePath in polymer.json for both by changing it to:

window.Polymer = {rootPath: document.querySelector('base').href};

The base tag handles resolving file and import paths, but without setting Polymer.rootPath the bindings used for the routes will still be set to the root path.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants