Déployer Nuxt avec Vercel
Comment déployer Nuxt avec Vercel ?
Static avec Vercel
Si vous souhaitez déployer un site statique sur Vercel, aucune configuration n'est nécessaire. Vercel détectera que vous utilisez Nuxt et activera les bons paramètres pour votre déploiement. Pour plus d'informations, consultez ce guide Vercel .
SSR avec Vercel
Pour déployer un runtime Nuxt serverless avec Vercel , l'équipe et les contributeurs Nuxt ont produit un @nuxtjs/vercel-builder package.
Vous n'avez qu'à configurer le fichier vercel.json
:
{
"builds": [
{
"src": "nuxt.config.js",
"use": "@nuxtjs/vercel-builder",
"config": {}
}
]
}
Consultez la documentation pour plus d'informations.
Service Worker avec Nuxt PWA Module
Pour éviter une 404 avec le Service Workers, assurez-vous d'inclure sw
dans vos paramètres de routes.
{
"version": 2,
"builds": [
{
"src": "nuxt.config.js",
"use": "@nuxtjs/vercel-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": "/" }
]
}
Vous pouvez en savoir plus et voir des exemples sur https://github.com/nuxt/vercel-builder

























































