praveenn77 / docusaurus-lunr-search

Local / Offline Search for docusaurus
https://praveenn77.github.io/docusaurus-lunr-search-demo/
MIT License
493 stars 79 forks source link

Error: Can't resolve 'lunr' with yarn #128

Closed vitonsky closed 11 months ago

vitonsky commented 12 months ago

Hi, thanks for search solution, i found bug - when i've tried to use this package with yarn, i've got error below

image

Explanation

As i understood, the problem is when i use plugin as described in docs

module.exports = {
  // ...
    plugins: [require.resolve('docusaurus-lunr-search')],
}

yarn do not handle it as import, so don't install transitive dependencies (which lunr is).

I can resolve this problem if i will just install dependency explicitly with yarn add -D lunr

Proposal

Let's improve install instructions, to not confuse another developers with this problem. I propose to mention that to use package docusaurus-lunr-search we have to install lunr

We can just fix text in section "How to Use ?" to npm i docusaurus-lunr-search lunr --save