Repository navigation
fix(docs): generate pagefind search index on build - #260
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
|
🎉 This PR is included in version 2.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The Nextra docs site (
apps/docs, added in #259) ships Nextra's built-in Pagefind-backed<Search />widget, but the build was never wired up to generate the Pagefind index. On the live site, searching anything threwFailed to load search index. TypeError: Failed to fetch dynamically imported module: .../_pagefind/pagefind.jsbecause that file was never produced -apps/docs/package.jsonhad nopagefinddependency and no step that runs it afternext build.This PR adds the
pagefinddev dependency and apostbuildscript per Nextra's documented Pagefind setup, so the search index is generated automatically every timeapps/docsis built.Changes
apps/docs/package.json- addedpagefind(^1.6.0) todevDependencies, and apostbuildscript (pagefind --site .next/server/app --output-path public/_pagefind) that runs automatically afteryarn buildcompletes.apps/docs/yarn.lock- lockfile entries for the newpagefinddependency.apps/docs/.gitignore- ignores the generatedpublic/_pagefind/directory (a build artifact, not source).How Has This Been Tested?
yarn install && yarn buildinapps/docs- the newpostbuildstep ran and generatedapps/docs/public/_pagefind/(pagefind.jsplus index/fragment files); Pagefind indexed 56 pages / 811 words / 1 language.yarn start(port 3000) and confirmed/_pagefind/pagefind.jsand/_pagefind/pagefind-entry.jsonboth return200(previously404, matching the reported bug).Checklist
Before submitting this PR, ensure that:
Reviewer Guidance
This is a build-tooling fix with no user-facing UI change - it restores existing search functionality rather than adding new UI.
apps/docsrunyarn install && yarn build.apps/docs/public/_pagefind/pagefind.jsexists after the build.yarn start, openhttp://localhost:3000, use the search box, and confirm real results appear with no "Failed to load search index" error.