Sobre
Plugin PWA para Nuxt sem necessidade de configuração.
Desenvolvimento web e de aplicativosO que você pode fazer
- 📖 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
Crescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- -1
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
Original
Nuxt PWA Ecosystem
🚀 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: client virtual modules are strictly optimized for Dead Code Elimination.
- 📄 Web Manifest: auto-inject Web App Manifest and PWA assets seamlessly.
- 💬 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
- 🔍 Inspector: visually inspect your resolved configuration, web manifest and service worker during development, via middleware or DevFrame
- 🧩 Modular: use the ready-to-use plugins or compose your own integration from the building blocks in
@unplugin-pwa/coreand@unplugin-pwa/vite - 📦 Universal Bundlers: native integration with Vite, Rolldown, Webpack (WIP), Rspack (WIP), and Rsbuild (WIP).
- 🛠️ Meta-Frameworks: seamless integration with îles, SvelteKit, VitePress, Astro, Nuxt 3/4/5, React Router, TanStack and Next (WIP).
- 💥 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
@vite-pwa/nuxtrequires Nuxt 3.9.0+ with the Vite builder.
npx nuxt module add @vite-pwa/nuxt
🦄 Usage
Add @vite-pwa/nuxt module to nuxt.config.ts and configure it:
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@vite-pwa/nuxt'],
pwa: {
/* PWA options */
},
})
The PWA options can also live in a pwa.config.ts file in your project root (or srcDir), which is loaded automatically:
// pwa.config.ts
import { definePwaConfig } from '@vite-pwa/nuxt'
export default definePwaConfig({
registerType: 'autoUpdate',
manifest: {
name: 'My App',
},
})
Use pwa.path in nuxt.config.ts to load the configuration from another file.
Read the 📖 documentation for a complete guide on how to configure and use this module.
⬆️ Migrating from v1
@vite-pwa/nuxtnow usesunplugin-pwaand@vite-pwa/workbox-*instead ofvite-plugin-pwaandworkbox-*. If you import Workbox modules in a custom service worker, replaceworkbox-*imports with their@vite-pwa/workbox-swkit/*counterparts.- The
workboxoption is nowgenerateSW(workboxstill works but logs a deprecation warning). - The
injectManifeststrategy only injects the precache manifest into an existing service worker in thepublicfolder. Service workers written in TypeScript or living outsidepublicmust use thebuildSWstrategy (strategies: 'buildSW'and thebuildSWoption). - The
PwaModuleOptionstype is nowModuleOptions(PwaModuleOptionsis kept as a deprecated alias). $pwa.isInstalledhas been removed: use$pwa.isPWAInstalledinstead.$pwa.getSWRegistration()has been removed: use theservice-worker:registeredorservice-worker:activatedruntime hooks to access the service worker registration.- The
PwaAppleImage,PwaAppleSplashScreenImage,PwaFaviconImage,PwaMaskableImageandPwaTransparentImagecomponents are only registered whenpwaAssetsis enabled. - Deep imports from
@vite-pwa/nuxt/*are no longer available.
⚡️ Examples
Run pnpm dev to start the Nuxt v4 example in development mode. To see the PWA in action, build or generate the Nuxt v3 example and serve it:
pnpm dev:build && pnpm test:build:serve: Nuxt build command + start serverpnpm dev:generate && pnpm test:generate:serve: Nuxt generate command + start server
| Example | Source | Playground |
|---|---|---|
Nuxt v5: Auto Update PWA |
GitHub |
|
Nuxt v4: Auto Update PWA |
GitHub |
|
Nuxt v3: Auto Update PWA |
GitHub |
|
👀 Full config
Check the following links for more details.
📄 License
MIT License © 2023-PRESENT Anthony Fu
Explore projetos relacionados
Carregando…