Want to take a look at our new docs? Our new docs are now in beta. Have fun!

How to deploy with Vercel?

nuxt-vercel-builder

Vercel

To deploy with Vercel, the Nuxt.js team and contributors worked on an official @nuxtjs/vercel-builder package.

All you have to do is to setup a now.json file:

{
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/vercel-builder",
      "config": {}
    }
  ]
}

Service Worker with Nuxt PWA Module

To avoid 404 for Service Workers, make sure to include sw to your routes settings.

{
  "version": 2,
  "builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/now-builder",
      "config": {
        "serverFiles": ["package.json"]
      }
    }
  ],
  "routes": [
    { "src": "/_nuxt/.+", "headers": { "Cache-Control": "max-age=31557600" } },
    {
      "src": "/sw.js",
      "dest": "/_nuxt/static/sw.js",
      "headers": {
        "cache-control": "public, max-age=43200, immutable",
        "Service-Worker-Allowed": "/"
      }
    },
    { "src": "/(.*)", "dest": "/" }
  ]
}

You can learn more and see examples on https://github.com/nuxt/vercel-builder

Contributors

Contribution for this page is now closed. If you would like to contribute please check out our new docs are now in beta. Have fun!

Platinum Sponsors

StoryblokMoovweb Support Us