Vue + PWA
Installable app: manifest, icon and offline cache. This page shows exactly what pickstack adds to a Vue project for PWA: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework vue --modules pwa --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
vite-plugin-pwa | ^2.0.0 | dev |
New files
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<title>my-app</title>
<rect width="512" height="512" fill="#4f46e5" />
<text
x="256"
y="256"
fill="#ffffff"
font-family="system-ui, sans-serif"
font-size="280"
font-weight="700"
text-anchor="middle"
dominant-baseline="central"
>
M
</text>
</svg>
Changes to existing files
⋯ 3 unchanged lines <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>my-app</title>+ <meta name="theme-color" content="#4f46e5" />+ <link rel="icon" type="image/svg+xml" href="/pwa-icon.svg" /> </head> <body> <div id="app"></div>⋯ 4 unchanged lines
import { fileURLToPath, URL } from "node:url"; import vue from "@vitejs/plugin-vue"; import { defineConfig } from "vite";+import { VitePWA } from "vite-plugin-pwa"; export default defineConfig({+ plugins: [+ vue(),+ VitePWA({+ registerType: "autoUpdate",+ includeAssets: ["pwa-icon.svg"],+ manifest: {+ name: "my-app",+ short_name: "my-app",+ description: "my-app",+ theme_color: "#4f46e5",+ background_color: "#ffffff",+ icons: [+ {+ src: "pwa-icon.svg",+ sizes: "any",+ type: "image/svg+xml",+ purpose: "any",+ },+ {+ src: "pwa-icon.svg",+ sizes: "any",+ type: "image/svg+xml",+ purpose: "maskable",+ },+ ],+ },+ }),+ ],− plugins: [vue()], resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)),⋯ 4 unchanged lines
Project files
.gitignoreREADME.mdenv.d.tsindex.htmlpackage.jsonpublic/pwa-icon.svgsrc/App.vuesrc/assets/main.csssrc/components/CounterCard.vuesrc/main.tstsconfig.app.jsontsconfig.jsontsconfig.node.jsonvite.config.ts