Skip to content

fix(docs): generate pagefind search index on build - #260

Merged
michaeljymsgutierrez merged 3 commits into
mainfrom
fix/docs-search-pagefind-index
Nov 5, 2026
Merged

michaeljymsgutierrez merged 3 commits into
mainfrom
fix/docs-search-pagefind-index

Conversation

@michaeljymsgutierrez

Copy link
Copy Markdown
Owner

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 threw Failed to load search index. TypeError: Failed to fetch dynamically imported module: .../_pagefind/pagefind.js because that file was never produced - apps/docs/package.json had no pagefind dependency and no step that runs it after next build.

This PR adds the pagefind dev dependency and a postbuild script per Nextra's documented Pagefind setup, so the search index is generated automatically every time apps/docs is built.

Changes

  • apps/docs/package.json - added pagefind (^1.6.0) to devDependencies, and a postbuild script (pagefind --site .next/server/app --output-path public/_pagefind) that runs automatically after yarn build completes.
  • apps/docs/yarn.lock - lockfile entries for the new pagefind dependency.
  • apps/docs/.gitignore - ignores the generated public/_pagefind/ directory (a build artifact, not source).

How Has This Been Tested?

  • Manual testing: ran yarn install && yarn build in apps/docs - the new postbuild step ran and generated apps/docs/public/_pagefind/ (pagefind.js plus index/fragment files); Pagefind indexed 56 pages / 811 words / 1 language.
  • Started the built site with yarn start (port 3000) and confirmed /_pagefind/pagefind.js and /_pagefind/pagefind-entry.json both return 200 (previously 404, matching the reported bug).
  • Verified the search box in Chrome: queries for "collection" and "ApiResourceManager" returned real grouped result dropdowns with correct descriptions and highlighted matches. Swept the browser console (pagefind/TypeError/fetch/error patterns plus a full errors-only sweep) - zero hits.
  • No automated tests added - this is a build-tooling/config change to a docs app with no existing test suite.

Checklist

Before submitting this PR, ensure that:

  • Code follows the project's coding standards and best practices.
  • Tests are written for new functionality and existing tests pass.
  • Documentation is updated to reflect changes.
  • The PR is assigned to the correct reviewers.

Reviewer Guidance

This is a build-tooling fix with no user-facing UI change - it restores existing search functionality rather than adding new UI.

  • Pull the branch, then in apps/docs run yarn install && yarn build.
  • Confirm apps/docs/public/_pagefind/pagefind.js exists after the build.
  • Run yarn start, open http://localhost:3000, use the search box, and confirm real results appear with no "Failed to load search index" error.
  • Once merged, confirm the fix reaches the live deploy by testing the search box on the production docs URL.

@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
arm-js-library-docs Ready Ready Preview Nov 5, 2026 5:52pm UTC

@michaeljymsgutierrez michaeljymsgutierrez self-assigned this Nov 5, 2026
@michaeljymsgutierrez
michaeljymsgutierrez marked this pull request as ready for review November 5, 2026 17:53
@michaeljymsgutierrez
michaeljymsgutierrez merged commit c928683 into main Nov 5, 2026
4 checks passed
@michaeljymsgutierrez
michaeljymsgutierrez deleted the fix/docs-search-pagefind-index branch November 5, 2026 17:54
@michaeljymsgutierrez

Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 2.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant