Skip to content

Dev mode in docusaurus #173

Description

@adamyonk

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:
    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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions