Skip to content

Service worker file sw.js is missing on Vercel after fast re-deploys with target static #352

@kfrederix

Description

@kfrederix

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions