Skip to content

Commit

Permalink
fix(doc-tools): search index dev middleware (#3097)
Browse files Browse the repository at this point in the history
* fix: unexpected title

* fix: delete useless outdir

* fix: search index not found && support announcement

* chore: changeset

* feat: replace announcement with beforeNav

* fix: search index dev middleware

* chore: pnpm-lock
  • Loading branch information
sanyuan0704 committed Mar 9, 2023
1 parent 65c56f4 commit fcdac2a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .changeset/quick-hounds-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/doc-core': patch
---

fix: search index dev middleware

fix: search index 中间件无效
2 changes: 1 addition & 1 deletion packages/cli/doc-core/src/node/searchIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function serveSearchIndexMiddleware(config: UserConfig): RequestHandler {
path.join(config.doc?.base || '', searchIndexFile),
);

if (req.url === searchIndexRequestPath) {
if (req.url?.includes(searchIndexRequestPath)) {
res.setHeader('Content-Type', 'application/json');
const searchIndex = fs.readFileSync(
path.join(process.cwd(), OUTPUT_DIR, 'static', searchIndexFile),
Expand Down
6 changes: 2 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fcdac2a

Please sign in to comment.