Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is support mpa? #249

Closed
luozhihua opened this issue Mar 21, 2022 · 3 comments
Closed

is support mpa? #249

luozhihua opened this issue Mar 21, 2022 · 3 comments

Comments

@luozhihua
Copy link

A Multiple page app has multiple html page, how ever, vite-plugin-pwa generate only one route for index.html:

workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
    denylist: [/^\/backoffice/]
  }));

Is there a way to generating multipe route for multiple pages?

  • foo/index.html
  • bar/index.html
workbox.registerRoute(
    new workbox.NavigationRoute(
        workbox.createHandlerBoundToURL("foo/index.html"), 
    )
);
workbox.registerRoute(
    new workbox.NavigationRoute(
        workbox.createHandlerBoundToURL("bar/index.html"), 
    )
);
@userquin
Copy link
Member

userquin commented Mar 21, 2022

@luozhihua I have this repo for a vitesse clone using a custom sw: https://github.com/userquin/test-pwa-ts-4.5.5/blob/main/src/sw.ts, you can check the result here optimistic-cray-38ef22.netlify.app

You should also configure your server for serving the pages instead acting as a SPA, just check netlify.toml with the redirects for each route.

EDIT: since vitesse is using vue-router we map the html pages to the corresponding logical name on the router: https://github.com/userquin/test-pwa-ts-4.5.5/blob/main/src/sw.ts#L18. You should update the logic.

@userquin
Copy link
Member

@luozhihua you have some hints here: antfu-collective/vitesse#252 (comment)

@userquin
Copy link
Member

check vite-pwa/sveltekit#65 (comment)

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

No branches or pull requests

2 participants