Search code examples
docusaurus

Generating static Docusaurus site for use without without webserver


I have recently started experimenting with Docusaurus and have managed to add pages, menu items etc.

I can run the site locally using the following

npm run start

I have also attempted to build the site using

npm run build

This seems to require that the resulting files are server through a webserver. Is it possible to build the site so they can just be accessed locally through the file system?


Solution

  • Docusaurus maintainer here.

    I've just tested that yesterday and I don't think it can work easily.

    I also think Docusaurus is an SPA with history.push() navigation, don't think this is compatible with the file:// protocol but not totally sure either. If my assumption is correct, not having a webserver is impossible, unless we build your site in some kind of "no js" mode, and totally disable the SPA-based navigation.

    In all cases this is not a feature we support officially at the moment