Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack error when serving development build #179

Closed
vixducis opened this issue Mar 27, 2023 · 3 comments
Closed

Webpack error when serving development build #179

vixducis opened this issue Mar 27, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@vixducis
Copy link
Contributor

Please describe the bug you are seeing

error

When running the dev server, I get the above error. I was able to trace this down to @cmfcmf\docusaurus-search-local\lib\client\theme\SearchBar\index.js, where on several occasions mylunr is accessed.

It is imported on the following line:

import { mylunr, tokenize } from "./d-s-l-a-generated";

./d-s-l-a-generated just contains export {}; however, which explains the failing imports. The weird thing is that this is only happening with the node windows executable (v18.15.0), when I use node inside my WSL (v16.17.1), there doesn't seem to be an issue.

How can we best reproduce the bug?

No response

Which version of Docusaurus and @cmfcmf/docusaurus-search-local are you using?

"@docusaurus/core": "2.4.0"
"@cmfcmf/docusaurus-search-local": "1.0.0"

Which Node.js version are you using?

v18.15.0

Which theme are you using?

Yes, I am using @docusaurus/theme-classic

How does your plugin config look like?

[
        require.resolve("@cmfcmf/docusaurus-search-local"),
        {
          indexBlog: false,
        },
]

Additional context

No response

@vixducis vixducis added the bug Something isn't working label Mar 27, 2023
@vixducis vixducis changed the title Error Webpack error when serving development build Mar 27, 2023
@aamir1995
Copy link

You can downgrade to 0.11.0 until the issue is fixed.

cmfcmf added a commit that referenced this issue Apr 10, 2023
cmfcmf added a commit that referenced this issue Apr 10, 2023
cmfcmf added a commit that referenced this issue Apr 10, 2023
cmfcmf added a commit that referenced this issue Apr 10, 2023
cmfcmf added a commit that referenced this issue Apr 10, 2023
cmfcmf added a commit that referenced this issue Apr 10, 2023
cmfcmf added a commit that referenced this issue Apr 10, 2023
cmfcmf added a commit that referenced this issue Apr 10, 2023
@cmfcmf
Copy link
Owner

cmfcmf commented Apr 10, 2023

The weird thing is that this is only happening with the node windows executable (v18.15.0), when I use node inside my WSL (v16.17.1), there doesn't seem to be an issue.

Thanks a lot for providing this additional insight! It turns out that the issue was Windows-specific - the d-s-l-a-generated.js file should have been generated with Webpack here:

test: /client\/theme\/SearchBar\/d-s-l-a-generated\.js$/,

However, I didn't realize that Webpack's rules.test option doesn't normalize backslashes and slashes, and so the file wasn't created on Windows.

I fixed this in #180 and will release a new version with this fix shortly.

@vixducis
Copy link
Contributor Author

Truly awesome, man!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants