emersonbottero / vitepress-plugin-search

Provide local search to your documentation site.
MIT License
238 stars 30 forks source link

build is not working #58

Closed Zeus-Iqd closed 1 year ago

Zeus-Iqd commented 1 year ago

I use this plugin. when I npm run build .this is not working .

image
emersonbottero commented 1 year ago

can you share a repo?

AfireHong commented 1 year ago

试试在vite的配置里面把build.ssr设置成false。 Try setting build.ssr to false in vite's configuration, it works in my project

mil7 commented 1 year ago

@AfireHong, thanks for the idea to explicitely set build.ssr to false. This did help me as well.

@emersonbottero, is this a common issue? Shouldn't you/we mention it in the Readme?

emersonbottero commented 1 year ago

it worked before, maybe something changed in the last vitepress version.. I'll do some tests first.

shadow-light commented 1 year ago

This fixed it for me:

        async load(this, id) {
            if (id !== resolvedVirtualModuleId)
                return
            if (!computedIndex){
                // Avoid computing the index more than once
                computedIndex = await IndexSearch(config.root, options)
            }
            return computedIndex
        },
shadow-light commented 1 year ago

It does seem to compute it twice still, probably due to async. But at least it works.

joshshannon commented 1 year ago

I think #60 is a duplicate of this issue. A PR was merged to fix this issue and builds seem to be working correctly in 1.0.4-alpha.20 without the build.ssr workaround.