kevinmarrec / nuxt-pwa-module

⚠️ DEPRECATED ⚠️ Zero config PWA solution for Nuxt 3
MIT License
338 stars 32 forks source link

PWA does not seem to work with rc-7 (Vite 3) #32

Closed rmenai closed 1 year ago

rmenai commented 1 year ago

Reproduction steps

Lighthouse

image

Upon upgrading to rc-7, my pwa is lo longer installable. This might be because Vite was updated to version 3.

toniengelhardt commented 1 year ago

Also having issues...

BenjaminOddou commented 1 year ago

Same here. The manifest file is not available under the root link /manifest.json.

kevinmarrec commented 1 year ago

Hi, I'm off for almost 2 weeks so I won't be able to take a look quickly.

This is a framework upstream issue which indeed may be caused by Vite upgrade.

/cc @pi0

brambekkers commented 1 year ago

Has anyone found a solution for this?

BenjaminOddou commented 1 year ago

unfortunately not for the moment @brambekkers

mjzarrin commented 1 year ago

I could run PWA in dev mode however when I build my project, the PWA manifest gets replaced by the Nuxt manifest.

    "@kevinmarrec/nuxt-pwa": "^0.4.2",
    "nuxt": "3.0.0-rc.8",
// http://localhost:3000/manifest.json in dev mode

{
  "name": "NAME",
  "short_name": "SNAME",
  "description": "DESCRIPTION",
  "lang": "en",
  "start_url": "/?standalone=true",
  "display": "standalone",
  "background_color": "#ffffff",
  "theme_color": "#000000",
  "icons": [
    {
      "src": "/_nuxt/icons/64x64.png",
      "type": "image/png",
      "sizes": "64x64",
      "purpose": "any"
    },
...
}
// http://localhost:3000/manifest.json in prod mode

{
  "node_modules/@mdi/font/fonts/materialdesignicons-webfont.eot": {
    "file": "_nuxt/materialdesignicons-webfont.861aea05.eot",
    "src": "node_modules/@mdi/font/fonts/materialdesignicons-webfont.eot"
  },
  "node_modules/@mdi/font/fonts/materialdesignicons-webfont.woff2": {
    "file": "_nuxt/materialdesignicons-webfont.e52d60f6.woff2",
    "src": "node_modules/@mdi/font/fonts/materialdesignicons-webfont.woff2"
  },
  "node_modules/@mdi/font/fonts/materialdesignicons-webfont.woff": {
    "file": "_nuxt/materialdesignicons-webfont.48d3eec6.woff",
    "src": "node_modules/@mdi/font/fonts/materialdesignicons-webfont.woff"
  },
  "node_modules/@mdi/font/fonts/materialdesignicons-webfont.ttf": {
    "file": "_nuxt/materialdesignicons-webfont.bd725a7a.ttf",
    "src": "node_modules/@mdi/font/fonts/materialdesignicons-webfont.ttf"
  },

...
}
kevinmarrec commented 1 year ago

Hi, I'm back from my days off and will try to work on a fix this week.

pi0 commented 1 year ago

Likely solved by https://github.com/nuxt/framework/pull/7021 (try on edge)

kevinmarrec commented 1 year ago

If anyone want to try the upstream fix, you can try this in your package.json then run your package manager to install the Nuxt Edge version that contains the potential fix.

{
  "devDependencies": {
-   "nuxt": "^3.0.0-rc.8"
+   "nuxt": "npm:nuxt3@3.0.0-rc.8-27696104.af2835f"
  }
}
kevinmarrec commented 1 year ago

Update

You can now try with last Release candidate version :

{
  "devDependencies": {
-   "nuxt": "^3.0.0-rc.8"
+   "nuxt": "^3.0.0-rc.9"
  }
}

This issue should be resolved.

rmenai commented 1 year ago

Perfect now we can close this issue

Corentin7301 commented 1 year ago

Hi! I'm sorry but, after Nuxt update (rc8 --> rc9), I've the same problem...

CleanShot 2022-09-12 at 17 05 13

Nuxt version : ^3.0.0-rc.9 Nuxt PWA version : ^0.4.2

How can I solve this error?

brambekkers commented 1 year ago

Hi! I'm sorry but, after Nuxt update (rc8 --> rc9), I've the same problem...

CleanShot 2022-09-12 at 17 05 13

Nuxt version : ^3.0.0-rc.9 Nuxt PWA version : ^0.4.2

How can I solve this error?

Ill have the same issue. No Service worker and no start url.

I have workbox enabled. nuxt": "^3.0.0-rc.9", " @kevinmarrec/nuxt-pwa": "^0.4.2",

kevinmarrec commented 1 year ago

Gonna have a closer look with the help of the framework team.

JohanDufau commented 1 year ago

Hi! The issue is fixed with rc9 in prod mode.

FYI, this module requires ssr on. Also, it does not work in dev mode, I turn off workbox in dev like this in next.config: workbox: { enabled: process.env.NODE_ENV === 'production', },

After building with upgraded nuxt, I advise to clear your cache.

toniengelhardt commented 1 year ago

Why does it require ssr on?

JohanDufau commented 1 year ago

To serve manifest.json ;)

Corentin7301 commented 1 year ago

Thanks for fixing!

FYI, this module requires ssr on. Is there any way to make it work in CSR? It's quite annoying...

toniengelhardt commented 1 year ago

To serve manifest.json ;)

Is this somehow a limitation with Nuxt 3? The original @nuxtjs/pwa module serves the manifest also with ssr: false.

kevinmarrec commented 1 year ago

I will consider a solution to have the module working with ssr: false.

As a reminder, having Workbox running in development is not recommended and should be used only for testing some behaviors locally. Cause be aware that having it enabled will make your Nuxt application serve cached files through the Service Worker and therefore you would need to empty cache often when developing.

Also, if you have a requirement to use Workbox in development, please use Private Window feature of your favorite browser to prevent anything to be cached the next time you open the app without it enabled.

kevinmarrec commented 1 year ago

v0.5.0 is out !