vite-pwa / astro

Zero-config PWA Integration for Astro
https://vite-pwa-org.netlify.app/frameworks/astro
MIT License
170 stars 5 forks source link
astro astro-integration pwa vite vite-plugin workbox

@vite-pwa/astro - Zero-config PWA Integration for Astro
Zero-config PWA Integration for Astro

NPM version NPM Downloads Docs & Guides
GitHub stars


๐Ÿš€ Features

๐Ÿ“ฆ Install

From v0.2.0, @vite-pwa/astro requires Vite 5 and Astro 4.0.0 or above.

Using any version older than v0.2.0 requires Vite 3.1.0+.

npm i @vite-pwa/astro -D 

# yarn 
yarn add @vite-pwa/astro -D

# pnpm 
pnpm add @vite-pwa/astro -D

๐Ÿฆ„ Usage

Add @vite-pwa/astro integration to astro.config.mjs and configure it:

// astro.config.mjs
import { defineConfig } from 'astro/config'
import AstroPWA from '@vite-pwa/astro'

// https://astro.build/config
export default defineConfig({
  integrations: [AstroPWA()]
})

Read the ๐Ÿ“– documentation for a complete guide on how to configure and use this plugin.

โšก๏ธ Examples

You need to stop the dev server once started and then run npm run build && npm run preview to see the PWA in action.

Example Source Playground
Auto Update PWA GitHub Open in StackBlitz
Prompt for Update PWA GitHub Open in StackBlitz

๐Ÿ‘€ Full config

Check out the following links for more details:

๐Ÿ“„ License

MIT License © 2022-PRESENT Anthony Fu