Member-only story
How did I get Docusaurus2’s offline Lunr search to work?
Developing and maintaining technical documentation as code (Docs As Code) only gets better with Docusaurus.69 version.
This quick guide is for you if you want to enable Lunr search on your website for a better user experience, but are unable to proceed because of the swizzle
error.
Well !!!
npm install
before theswizzle
command is the way to go. It is now officially accepted on the website > here :)
If the search yields no result, stop trying with yarn and build with
npm run build
and start the server withnpx http-server ./build
ornpx http-server build
.Your local server runs on
http://127.0.0.1:8080
.
Note: Docusaurus search information can only be generated from a production build. Local development is currently not supported.
To begin with, you have already done the following:
- Created a docusaurus project (
npx @docusaurus/init@latest initi my-website classic)
or migrated your project from an earlier version to .69 version (yarn upgrade @docusaurus/core@2.0.0-alpha.69 @docusaurus/preset-classic@2.0.0-alpha.69
). - Installed Lunr search following the document.