Search code examples
offlinegridsome

Unable to use gridsome website in offline mode


I've built a gridsome website, but when I try to use it offline (by directly loading index.html into my browser), it fails to load the files in the assets folder, and links to other pages fails

running in windows: after installing gridsome, I did the following:

gridsome create sample
cd sample
gridsome build

then I went to file explorer and opened the sample/dist directory and double clicked on index.html (Chrome is my default browser, but IE behaves the same)

the result is a half-loaded webpage that is missing the style sheets, javascript, images, and links are broken.

For instance, the "about" link on the first page points to "D:/about" vs. ".\about.html".

Is there anyway to make gridsome work to create a truly off-line website?


Solution

  • A website needs a webserver. When you are running in dev mode Gridsome provides that for you, when you build out the site you need something to serve it to your browser.