From 7234eebe7e00c42ccf7d08c95eb617ac274ce049 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Sun, 15 Feb 2026 12:31:46 +0800 Subject: [PATCH] fix(plugin-search): fix incorrect prepare search index --- plugins/plugin-search/src/node/searchPlugin.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/plugin-search/src/node/searchPlugin.ts b/plugins/plugin-search/src/node/searchPlugin.ts index 68def46f..3283208f 100644 --- a/plugins/plugin-search/src/node/searchPlugin.ts +++ b/plugins/plugin-search/src/node/searchPlugin.ts @@ -33,9 +33,14 @@ export function searchPlugin({ }, onPrepared: async (app) => { - const placeholder = prepareSearchIndexPlaceholder(app) - prepareSearchIndex({ app, isSearchable, searchOptions }) - await placeholder + if (app.env.isBuild) { + await prepareSearchIndex({ app, isSearchable, searchOptions }) + } + else { + const placeholder = prepareSearchIndexPlaceholder(app) + await placeholder + placeholder.then(() => prepareSearchIndex({ app, isSearchable, searchOptions })) + } }, onWatched: (app, watchers) => {