Search code examples
deploymentnuxt.jsnuxt3.js

How to deploy and generate a static site on Nuxt 3?


I'm creating website on Nuxt and I have created a new app on Nuxt 3. But I have a problem for the deployment, there is no 'normal' build for 'normal server' as Nuxt 2.x.

I'm using 'Lambda' preset. https://v3.nuxtjs.org/docs/deployment/presets/lambda

// nuxt.config.ts

import { defineNuxtConfig } from 'nuxt3'

// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
  // Global page headers: https://go.nuxtjs.dev/config-head

  nitro: {
    preset: 'lambda'
  },

  head: {
    title: 'Title',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' }
 
      
    ],
    link: [
      { rel: 'icon', type: 'image/png', href: '/favicon.png' }
    ],
  script: [
    {  
      type: 'text/javascript', 
      src: '/mana.js',
  }
]
},
})

And on Nuxt 2.x I used this:

// nuxt.config.js

export default {
  // Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
  ssr: false,

  // Target: https://go.nuxtjs.dev/config-target
  target: 'static'
}

What configuration should I use on Nuxt 3 to have 'normal' export with an index.html file at the root for all server?


Solution

  • Static deployment is not currently available for Nuxt 3