vite-pwa / vite-plugin-pwa

Zero-config PWA for Vite

Home Page:https://vite-pwa-org.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use build.outDir from vite for custom public/sw.js file

iammati opened this issue · comments

commented

I'm really new to service worker, workbox and PWA. Got following situation:

My vite setup is located inside ~/app/frontend/vite.config.ts thus contains build.outDir which links to ../../public/dist.
I'd need to configure the same for the PWA plugin or that at least the PWA automatically checks whether build.outDir has been configured and makes use of it instead of searching for public/sw.js at the relative path of the vite.config.ts.

I might be wrong, but that's so far my assumption of this issue to me, correct me in case I'm wrong! :)

Thanks

commented

Welp just found out that there's srcDir...

VitePWA({
    srcDir: '',
})