diff --git a/.changeset/quick-hounds-return.md b/.changeset/quick-hounds-return.md new file mode 100644 index 000000000000..64b4de000f91 --- /dev/null +++ b/.changeset/quick-hounds-return.md @@ -0,0 +1,7 @@ +--- +'@modern-js/doc-core': patch +--- + +fix: search index dev middleware + +fix: search index 中间件无效 diff --git a/packages/cli/doc-core/src/node/searchIndex.ts b/packages/cli/doc-core/src/node/searchIndex.ts index ba683549ba3e..4b43a5d992ec 100644 --- a/packages/cli/doc-core/src/node/searchIndex.ts +++ b/packages/cli/doc-core/src/node/searchIndex.ts @@ -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), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d3964d8d0ced..7c54bd89337a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15235,10 +15235,8 @@ packages: ajv: 6.12.6 dev: false - /ajv-formats/2.1.1_ajv@8.11.0: + /ajv-formats/2.1.1: resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} - peerDependencies: - ajv: ^8.0.0 peerDependenciesMeta: ajv: optional: true @@ -30968,7 +30966,7 @@ packages: dependencies: '@types/json-schema': 7.0.11 ajv: 8.11.0 - ajv-formats: 2.1.1_ajv@8.11.0 + ajv-formats: 2.1.1 ajv-keywords: 5.1.0_ajv@8.11.0 /scmp/2.1.0: