vite-pwa / vite-plugin-pwa

Zero-config PWA for Vite
https://vite-pwa-org.netlify.app/
MIT License
3.07k stars 201 forks source link

Cannot get started using Nuxt 3 #732

Open PaulCombal opened 1 month ago

PaulCombal commented 1 month ago

I've followed the instructions installing the module with Nuxi, and adding <VitePwaManifest /> to app.vue.

Then nothing happens, after some digging, it is because in VitePwaManifest.mjs, the import import { pwaInfo } from "virtual:pwa-info"; fails. (pwaInfo is undefined).

My nuxt.config is empty: pwa: {}

root@568df2510c73:/src# yarn why vite
├─ @nuxt/vite-builder@npm:3.12.3
│  └─ vite@npm:5.3.3 (via npm:^5.3.2)
│
├─ @nuxt/vite-builder@npm:3.12.3 [a9fb2]
│  └─ vite@npm:5.3.3 [2c305] (via npm:^5.0.0 [2c305])
│
└─ vite-node@npm:1.6.0
   └─ vite@npm:5.3.3 [2c305] (via npm:^5.0.0 [2c305])
root@568df2510c73:/src# yarn why @vite-pwa/nuxt
└─ telegram-front@workspace:.
   └─ @vite-pwa/nuxt@npm:0.9.1 [a9fb2] (via npm:latest [a9fb2])
userquin commented 1 month ago

Try adding also vite-plugin-pwa and workbox-window as dev dependencies. Check scafolding section in the docs: select vue + nuxt in the prompts

PaulCombal commented 1 month ago

This doesn't seem to make any difference.. Here is my package.json:

  "devDependencies": {
    "@nuxt/devtools": "^1.0.8",
    "@nuxt/image": "latest",
    "@nuxtjs/i18n": "^8.3.0",
    "@sidebase/nuxt-auth": "^0.8.0",
    "@vite-pwa/nuxt": "latest",
    "nuxt": "^3.12.4",
    "vite-plugin-pwa": "^0.20.0",
    "workbox-window": "^7.1.0"
  },
  "dependencies": {
    "@mdi/font": "^6.5.95",
    "@nuxt/vite-builder": "^3.12.2",
    "@pinia/nuxt": "^0.5.1",
    "@vueuse/nuxt": "^10.11.0",
    "apexcharts": "3.36.3",
    "perfect-debounce": "^1.0.0",
    "pinia": "^2.1.7",
    "sass": "^1.49.9",
    "vue": "^3.4.29",
    "vue-tabler-icons": "^2.9.0",
    "vue3-apexcharts": "^1.4.1",
    "vue3-perfect-scrollbar": "^1.6.0",
    "vuetify": "^3.6.9"
  },

I'm not planning to scaffold a new app, but rather to turn an existing one into a fully fledged PWA!

Even then, I ran the scaffolding script, and it yields the same result: pwaInfo is undefined..