nuxt / website-v2

Nuxt 2 Documentation Website
https://v2.nuxt.com
Other
2.25k stars 1.2k forks source link

Heroku offers static deployment #1636

Open valentinoli opened 2 years ago

valentinoli commented 2 years ago

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"
  }
}
Atinux commented 2 years ago

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

valentinoli commented 2 years ago

Yes, sure, I can do that