website-v2 icon indicating copy to clipboard operation
website-v2 copied to clipboard

Heroku offers static deployment

Open valentinoli opened this issue 3 years ago • 2 comments

Hello, I noticed that the Deployment section states only deployment for target: server is possible via Heroku. Actually, static deployment is possible using heroku-buildpack-static in conjunction with the Heroku buildpack for Node.js.

The order of buildpacks is this:

image

First, the Node.js buildpack installs all dependencies with npm install and then runs the build script in package.json which should be configured as "build": "nuxt generate" in the scripts section of package.json. This builds the app inside the dist/ folder. Then, heroku-buildpack-static takes over (it uses nginx). For this buildpack, we need to provide static.json in the root. Here is a minimal example:

{
  "root": "dist",
  "routes": {
    "/**": "index.html"
  }
}

valentinoli avatar Aug 24 '21 20:08 valentinoli

Thank you for the heads up @valentinoli

Would you mind opening a pull request to update the documentation? https://github.com/nuxt/nuxtjs.org/blob/main/content/en/guides/deployment/heroku-deployment.md

atinux avatar Aug 24 '21 23:08 atinux

Yes, sure, I can do that

valentinoli avatar Aug 25 '21 05:08 valentinoli