Pwa-module: Service worker file sw.js is missing on Vercel after fast re-deploys with target static

Created on 17 Sep 2020  路  4Comments  路  Source: nuxt-community/pwa-module

This issue is related to the combination of:

  • new target: static improvements introduced in nuxt 2.14.0
  • this pwa module, which generates sw.js during webpack build
  • static hosting platforms like Vercel

Versions

  • nuxt: 2.14.5
  • node: 12.x

Steps to reproduce

  1. Create new nuxt app with target: 'static'
  2. Add @nuxtjs/pwa module
  3. Deploy to vercel (using build command: nuxt generate)
  4. Observe sw.js is there (= ok)
  5. Trigger web hook for re-deploy (will skip webpack build)
  6. Observe sw.js is missing (= not ok)

What is Expected?

sw.js should be present after fast generate using previous build cache (skipping webpack build).

What is actually happening?

sw.js is missing after fast generate using previous build cache (skipping webpack build).

So it seems to me like the generated sw.js file is not included in the build cache which is stored on Vercel, and therefore it will get missed when doing fast re-deploys which skip the webpack build step.

Not sure if this issue belongs here, or rather in the actual nuxt.js repo...

bug

All 4 comments

Our sites are starting to fail - is this related?

image


Any workaround for this? How can I trigger a full rebuild on vercel?

@codeofsumit nop please see #365 (fixed in v3.1.1)

Hi. Sorry for inconveniences. This issue should be resolved by v3.2.0

Thanks @pi0 !

Was this page helpful?
0 / 5 - 0 ratings