Shared PWA utilities and integrations for Astro projects in the monorepo.
- Service Worker Generation: Astro integration that generates service workers with i18n support
- Vite Plugin: Exclude specific files from the public directory in build output
- Service Worker Template: Customizable service worker template with offline support
import { generateServiceWorker } from "@repo/astro-pwa/integration";
export default defineConfig({
integrations: [generateServiceWorker()],
});The integration uses the built-in service worker template by default. You can customize paths if needed:
generateServiceWorker({
i18nConfigPath: "src/i18n/languages.ts", // default
templatePath: "custom/path/sw.template.js", // optional, uses package template by default
outputPath: "public/sw.js", // default
})import { excludePublicFiles } from "@repo/astro-pwa/vite-plugin";
export default defineConfig({
vite: {
plugins: [excludePublicFiles(["sw.template.js"])],
},
});@vite-pwa/astro: PWA support for Astroworkbox-window: Workbox window module for service worker registration