cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
438 stars 67 forks source link

Module not found when starting local development - polyfill #69

Closed pdegrazia closed 2 years ago

pdegrazia commented 2 years ago

Bug description

Cannot start docusaurus locally, following error message is displayed in the browser

Module not found: Error: Can't resolve 'path' in '/home/paolo/workspace/wiki/node_modules/@babel/core/lib/config'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
    - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "path": false }

Additional output is provided in the terminal, all messages are very similar, they refer to buffer, assert, etc.

Reproduction

  1. Install plugin via yarn (as per readme)
  2. configure plugin in the plugin section of docusaurus config (as per readme, changed only the language, included below)
  3. try to run locally with yarn start

Environment

Package Versions

├─ @cmfcmf/docusaurus-search-local@0.6.7 ├─ @docusaurus/core@2.0.0-beta.8 ├─ @docusaurus/cssnano-preset@2.0.0-beta.8 ├─ @docusaurus/mdx-loader@2.0.0-beta.8 ├─ @docusaurus/plugin-content-blog@2.0.0-beta.8 ├─ @docusaurus/plugin-content-docs@2.0.0-beta.8 ├─ @docusaurus/plugin-content-pages@2.0.0-beta.8 ├─ @docusaurus/plugin-debug@2.0.0-beta.8 ├─ @docusaurus/plugin-google-analytics@2.0.0-beta.8 ├─ @docusaurus/plugin-google-gtag@2.0.0-beta.8 ├─ @docusaurus/plugin-sitemap@2.0.0-beta.8 ├─ @docusaurus/preset-classic@2.0.0-beta.8 ├─ @docusaurus/react-loadable@5.5.0 ├─ @docusaurus/theme-classic@2.0.0-beta.8 ├─ @docusaurus/theme-common@2.0.0-beta.8 ├─ @docusaurus/theme-search-algolia@2.0.0-beta.8 ├─ @docusaurus/types@2.0.0-beta.8 ├─ @docusaurus/utils-common@2.0.0-beta.8 ├─ @docusaurus/utils-validation@2.0.0-beta.8 └─ @docusaurus/utils@2.0.0-beta.8

Node Version

v14.17.0

Docusaurus Environment

[
      require.resolve('@cmfcmf/docusaurus-search-local'),
      {
        indexDocs: true,
        docsRouteBasePath: '/docs',
        indexDocSidebarParentCategories: 0,
        indexBlog: true,
        blogRouteBasePath: '/blog',
        indexPages: false,
        language: "it",
        style: undefined,
        lunr: {
          tokenizerSeparator: /[\s\-]+/
        }
      }
    ],

Additional context

Nothing to add

pdegrazia commented 2 years ago

Update: I can not reproduce this by using a fresh installation of docusaurus

I guess my problem is that I started creating my website with docusaurus alpha.72, but, while being able to upgrade docusarus to beta8 using yarn, something clearly did not update correctly

Issue seems to be related to docusaurus, rather than the search plugin, can be closed

Anyway, if someone has any suggestion, it will be really appreciated

EDIT: solved the problem, issue was on my side, there was a problem with my code that was not highlighted until I used search

sriramgroot commented 2 years ago

@pdegrazia can you post here what was the problem you were facing in your code base. Iam facing this issue now

pdegrazia commented 2 years ago

@pdegrazia can you post here what was the problem you were facing in your code base. Iam facing this issue now

Screenshot_20220412-124855_Discord

This is it

sriramgroot commented 2 years ago

@pdegrazia could you please elaborate you post/reply. I couldn't understand.