Plugin fails with "[vite] Internal server error: _.existsSync is not a function"
Closed this issue · 2 comments
I've installed your plugin with the instructions from the README.md file. However, when I run vitepress dev docs
, the following error message is printed to the console:
[vite] Internal server error: _.existsSync is not a function at Context.load (/Users/patrickineichen/Git/arc42-vitepress/node_modules/vitepress-plugin-simple-search/dist/simple-search.umd.js:1:2042) at Object.load (file:///Users/patrickineichen/Git/arc42-vitepress/node_modules/vite/dist/node/chunks/dep-4da11a5e.js:41084:46) at loadAndTransform (file:///Users/patrickineichen/Git/arc42-vitepress/node_modules/vite/dist/node/chunks/dep-4da11a5e.js:37312:46) at doTransform (file:///Users/patrickineichen/Git/arc42-vitepress/node_modules/vite/dist/node/chunks/dep-4da11a5e.js:37298:20) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5)
My assumption is, that you need to provide fs-extra
in the output globals of vite.config.ts
and reference fs
from fs-extra
in src/index.ts
.
At least, it worked this way when I tried it out locally.
I can make a pull request if required.
I've downgroaded to v1.2.1 and it works.
Same here,
I am not very fluent with all this typescript vinegret, so I just removed the whole if statement:
if(!_.existsSync(c))throw console.warn(`File Pathway: ${c} does not exist. Search could not be built.`),console.warn("Try 'process.cwd() + your folder'"),new Error("Docs pathway could not be found.");
, since I always expect the docs folder to be in place.
Thanks for the plugin!