MCPcopy
hub / github.com/vite-pwa/vite-plugin-pwa

github.com/vite-pwa/vite-plugin-pwa @v1.3.0 sqlite

repository ↗ · DeepWiki ↗ · release v1.3.0 ↗
185 symbols 597 edges 152 files 0 documented · 0%
README

vite-plugin-pwa - Zero-config PWA for Vite

Zero-config PWA Framework-agnostic Plugin for Vite

NPM version NPM Downloads Docs & Guides

GitHub stars

🚀 Features

  • 📖 Documentation & guides
  • 👌 Zero-Config: sensible built-in default configs for common use cases
  • 🔩 Extensible: expose the full ability to customize the behavior of the plugin
  • 🦾 Type Strong: written in TypeScript
  • 🔌 Offline Support: generate service worker with offline support (via Workbox)
  • Fully tree shakable: auto inject Web App Manifest
  • 💬 Prompt for new content: built-in support for Vanilla JavaScript, Vue 3, React, Svelte, SolidJS and Preact
  • ⚙️ Stale-while-revalidate: automatic reload when new content is available
  • Static assets handling: configure static assets for offline support
  • 🐞 Development Support: debug your custom service worker logic as you develop your application
  • 🛠️ Versatile: integration with meta frameworks: îles, SvelteKit, VitePress, Astro, Nuxt 3 and Remix
  • 💥 PWA Assets Generator: generate all the PWA assets from a single command and a single source image
  • 🚀 PWA Assets Integration: serving, generating and injecting PWA Assets on the fly in your application

📦 Install

From v0.17, vite-plugin-pwa requires Vite 5.

From v0.16 vite-plugin-pwa requires Node 16 or above: workbox v7 requires Node 16 or above.

From v0.13, vite-plugin-pwa requires Vite 3.1 or above.

npm i vite-plugin-pwa -D

# yarn
yarn add vite-plugin-pwa -D

# pnpm
pnpm add vite-plugin-pwa -D

🦄 Usage

Add VitePWA plugin to vite.config.js / vite.config.ts and configure it:

// vite.config.js / vite.config.ts
import { VitePWA } from 'vite-plugin-pwa'

export default {
  plugins: [
    VitePWA()
  ]
}

Read the 📖 documentation for a complete guide on how to configure and use this plugin.

Check out the client type declarations client.d.ts for built-in frameworks support.

👀 Full config

Check out the type declaration src/types.ts and the following links for more details.

📄 License

MIT License © 2020-PRESENT Anthony Fu

Extension points exported contracts — how you extend this code

PwaInfo (Interface)
(no doc)
info.d.ts
PWAAssetHeadLink (Interface)
(no doc)
pwa-assets.d.ts
RegisterSWOptions (Interface)
(no doc)
types/index.d.ts
PWAPluginContext (Interface)
(no doc)
src/context.ts
PWAIntegration (Interface)
(no doc)
src/types.ts
RegisterSWOptions (Interface)
(no doc)
src/client/type.d.ts
PWAHtmlLink (Interface)
(no doc)
src/pwa-assets/types.ts
VirtualPwaInfo (Interface)
(no doc)
src/plugins/info.ts

Core symbols most depended-on inside this repo

VitePWA
called by 13
src/index.ts
normalizePath
called by 11
src/utils.ts
checkForHtmlHead
called by 4
src/html.ts
generateSimpleSWRegister
called by 3
src/html.ts
generateWebManifest
called by 3
src/html.ts
generateWebManifestFile
called by 3
src/assets.ts
generateServiceWorker
called by 3
src/modules.ts
updateServiceWorker
called by 3
src/client/dev/vue.ts

Shape

Function 151
Interface 34

Languages

TypeScript100%

Modules by API surface

src/types.ts14 symbols
src/api.ts14 symbols
src/plugins/dev.ts9 symbols
src/pwa-assets/types.ts7 symbols
src/plugins/pwa-assets.ts7 symbols
src/html.ts7 symbols
src/plugins/build.ts6 symbols
src/assets.ts6 symbols
scripts/run-examples.ts5 symbols
src/utils.ts4 symbols
src/pwa-assets/config.ts4 symbols
src/plugins/main.ts4 symbols

Dependencies from manifests, versioned

@antfu/ni0.21.9 · 1×
@playwright/test1.40.0 · 1×
@preact/preset-vite2.7.0 · 1×
@rolldown/pluginutils1.0.0-beta.31 · 1×
@rollup/plugin-replace5.0.5 · 1×
@roxi/routify2.18.12 · 1×
@solidjs/router0.9.1 · 1×
@sveltejs/adapter-staticnext · 1×
@sveltejs/kitnext · 1×
@sveltejs/vite-plugin-svelte3.0.0 · 1×
@tsconfig/svelte5.0.2 · 1×

For agents

$ claude mcp add vite-plugin-pwa \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact