ITADN

Dev mode in docusaurus

#173Openadamyonk 创建于 2025-03-18
A
adamyonkcommented
I think there is some path config issue in dev mode for `pagefind.js`. I was able to get around it using the following steps: 1. `ln -s node_modules/@getcanary/docusaurus-theme-search-pagefind/dist/pagefind.js static/pagefind-dev.js` 2. `npm run swizzle @getcanary/docusaurus-theme-search-pagefind SearchBar -- --eject` 3. In `src/theme/SearchBar/index.jsx` L13: ```javascript React.useEffect(() => { const prod = process.env.NODE_ENV === "production" const lib = prod ? `${siteConfig.baseUrl}pagefind/pagefind.js` : `${siteConfig.baseUrl}pagefind-dev.js` setPath(lib); }, [siteConfig]); ``` Just wanted to document that in case it can be streamlined in the theme itself!
0 条评论