hub icon indicating copy to clipboard operation
hub copied to clipboard

target: 'static'

Open glennjacobs opened this issue 4 years ago • 3 comments

To allow static hosting, we probably need to include the following in the Nuxt config

  // Target (https://go.nuxtjs.dev/config-target)
  target: 'static',

This allows a Nuxt project to be generated for static hosting. I'm unsure how dynamic routes will cope with this, but having tested on a new plain Nuxt install it somehow handles dynamic routes, e.g. /pages/blog/_slug.vue

This gets away from the nasty 404.html issue and introduces a nice index.html file instead.

glennjacobs avatar Nov 20 '20 22:11 glennjacobs

Having done more research, this option generates an index.html file and also a 200.html file as a fallback.

However, Netlify for example, uses 404.html as the fallback.

We may need to offer a guide for this, rather than offer a one size fits all solution.

glennjacobs avatar Nov 20 '20 23:11 glennjacobs

Also I think a problem we're potentially going to have is that it generates the pages from the pages directory. Currently it's empty as each part of the hub is made up of external modules and plugins that register their own routes and pages.

Maybe there is a way to tell Nuxt to generate those as well, doesn't solve the dynamic issue as you said however.

Using the query string was mentioned before but not sure if this is worth the time and effort as we don't really know how people are deploying. Maybe a set of guides under a "Deployment" heading would be beneficial so we could provide multiple avenues to users.

alecritson avatar Nov 21 '20 10:11 alecritson

The only real thing I think it changes is whether it generates an index.html file and what the fallback is, ie. 200.html or 404.html.

As you say, pages won't get generated. Maybe we should add an index page so we get an index.html?

Netlify just runs off the 404.html page.

glennjacobs avatar Nov 21 '20 11:11 glennjacobs