My Personal Junkyard

Web Development

An Ultra Minimal Guide to Deploy Nuxt SSR

anson

An Ultra Minimal Guide to Deploy Nuxt SSR

This short tutorial will be using Zeit Now to deploy Nuxt SSR application.

Expected Usage

In your Nuxt project folder, run

Then...

It will deploy to Zeit Now server and generate a link for you.

Repo: github.com/Ansonhkg/vue-ssr-deploy-sample

Steps

Create a zeit account

https://zeit.co/signup

Install Zeit Now

Login via terminal

Create Nuxt App

Add Now Builder for Nuxt.js

In your root directory, add a file called now.json

This Now builder takes a Nuxt.js application defined by a nuxt.config entrypoint and deploys it to a Now v2 serverless environment.
It features built-in caching of node_modules and the yarn global cache (even with dependency changes!) and multi-stage build for fast and small deployments.
Reference: nuxt/now-builder

Make sure Now have the compatible Node.js version (IMPORTANT)

Open package.json and add the following:

Change build directory (IMPORTANT)

Open nuxt.config.js, and add the following.

Generate

When launching nuxt generate or calling nuxt.generate(), Nuxt.js will use the configuration defined in the generate property.

Run the following command, t should create a directory called public in your project directory.

Check if public directory is indeed generated. If not, there's something wrong.

Finally, deploy.

Run

Tags:
Back to top