Hi there, I’m trying to publish a PWA to my repo using GitHub Pages which itself works fine but what I couldn’t get to work was routing when published (works fine on my machine
)
GH Pages url are structured like that: https://usernamer.github.io/repo-name/. But all I get when trying to visit one of its pages is a 404 altough its base URL is correctly set. I tried to do that:
console.log((import.meta as any).env.BASE_URL);
// ^ prints /repo-name/
router.setRoutes([
// temporarily cast to any because of a Type bug with the router
{
path: (import.meta as any).env.BASE_URL,
animate: true,
children: [
{ path: '', component: 'app-discount' },
{
path: 'discount',
component: 'app-discount',
action: async () => {
await import('./pages/app-discount.js');
},
},
{
path: 'about',
component: 'app-about',
action: async () => {
await import('./pages/app-about/app-about.js');
},
},
{
path: 'stats',
component: 'app-stats',
action: async () => {
await import('./pages/app-stats.js');
},
},
],
} as any,
]);
I’m using PWA builder and Vite but I’m not sure what’s to blame here. Any ideas?