Alexander Benjamin
Alexander Benjamin

Reputation: 323

NUXT SSR on Vercel (zeit now). How to deploy?

Could anyone please help me to deploy Nuxt SSR app to vercel.

I've set up my vercel project with github integration.
Using nuxt build for command and .nuxt for directory.

After deployment it shows me content of .nuxt/index.js file.

I'm using nuxt v2.13

Thank you very much.

Upvotes: 1

Views: 4608

Answers (2)

tsanjaya
tsanjaya

Reputation: 19

Hi I have the same issue

in my nuxt.config

mode: "universal", target: "static"

now.json

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

but still showing directory list

https://tonysanjaya-me-9ura97wgm.vercel.app/

Upvotes: 1

Alexander Benjamin
Alexander Benjamin

Reputation: 323

Resolved by adding now.json file.

Example of its content:

{
    "version": 2,
    "env": {
        "ON_VERCEL": "true"
    },
    "builds": [
        {
            "src": "api/**/*.js",
            "use": "@now/node"
        },
        {
            "src": "nuxt.config.js",
            "use": "@nuxtjs/now-builder"
        }
    ],
    "routes": [
        {  "src": "/api/(.*)", "dest": "api/index.js" },
        { "src": "/api", "dest": "api/index.js" },
        { "src": "/(.*)", "dest": "$1" }
    ]
}

Upvotes: 1

Related Questions