Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target: 'static' #21

Open
glennjacobs opened this issue Nov 20, 2020 · 3 comments
Open

target: 'static' #21

glennjacobs opened this issue Nov 20, 2020 · 3 comments
Assignees

Comments

@glennjacobs
Copy link
Contributor

glennjacobs commented Nov 20, 2020

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
Copy link
Contributor Author

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.

@alecritson
Copy link
Contributor

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.

@glennjacobs
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants