emersonbottero / vitepress-plugin-search

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

[bug] The search index data is removed from the final builds #60

Closed JeanJPNM closed 1 year ago

JeanJPNM commented 1 year ago

During development the virtual module virtual:search-data is loaded correctly, but when running vitepress build docs the chunk that should contain the indexes ends up looking like this:

// formatted for easy reading
const e = {},
  t = {},
  o = {
    previewLength: 62,
    buttonLabel: "Search",
    placeholder: "Search docs",
    tokenize: "full",
  },
  a = { INDEX_DATA: e, PREVIEW_LOOKUP: t, Options: o };
export { a as default };

vitepress-plugin-search is the only plugin I have installed, with the following configuration:

SearchPlugin({
  tokenize: "full",
})

The package versions are:

JeanJPNM commented 1 year ago

It appears that the source of the bug comes from this: https://github.com/emersonbottero/vitepress-plugin-search/blob/789167b8c63a2e8086adf6b1fbe26149843f5a04/src/index.ts#L46-L59