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

Can't resolve '../../client' error after swizzling SearchBar #25

Open
dtlhlbs opened this issue Nov 27, 2022 · 2 comments
Open

Can't resolve '../../client' error after swizzling SearchBar #25

dtlhlbs opened this issue Nov 27, 2022 · 2 comments

Comments

@dtlhlbs
Copy link

dtlhlbs commented Nov 27, 2022

Description

When I try to swizzle the docusaurus-theme-search-typesense SearchBar component it fails to compile docusaurus with an error.

Steps to reproduce

  1. Run yarn run swizzle docusaurus-theme-search-typesense SearchBar
  2. Select the 'Eject' option
  3. Run yarn start

Expected Behavior

Local Docusaurus will start without error with a copied version of the typesense searchbar as it was previously

Actual Behavior

Docusaurus launches with an error:

Compiled with problems:X

ERROR in ./src/theme/SearchBar/index.js 7:143-199

Module not found: Error: Can't resolve '../../client' in '<redacted>\content\src\theme\SearchBar'

Metadata

docusaurus/core: 2.2.0
docusaurus-theme-search-typesense: 0.8.0

@Kyriakos-Bekas
Copy link

I have the same issue.

My Metadata is the same, however I use npm instead of yarn and I swizzled the SearchBar component using the Typescript flag.

The issue seems to the relative path to the client module in the following line (inside src/theme/SearchBar/index.tsx - directory created by running the swizzling command)

import {useTypesenseContextualFilters} from '../../client';

I tried to manually change the path to the client module by replacing the previous import statement as such:

import { useTypesenseContextualFilters } from "docusaurus-theme-search-typesense/lib/client/index";

But got

Module not found: Error: Package path ./lib/client/index is not exported from package <redacted>/node_modules/docusaurus-theme-search-typesense (see exports field in <redacted>/node_modules/docusaurus-theme-search-typesense/package.json)
client (webpack 5.75.0) compiled with 1 error

And also as such

import { useTypesenseContextualFilters } from "docusaurus-theme-search-typesense/src/client/index";

But got again

Module not found: Error: Package path ./lib/client/index is not exported from package <redacted>/node_modules/docusaurus-theme-search-typesense (see exports field in <redacted>/node_modules/docusaurus-theme-search-typesense/package.json)
client (webpack 5.75.0) compiled with 1 error

@dtlhlbs
Copy link
Author

dtlhlbs commented Feb 24, 2023

Just noting here that Ejecting SearchPage also gives errors:

Module not found: Error: Can't resolve '../../hooks/useSearchPage' in 'C:\Users\DavidL\source\repos\hilltop-docs\content\src\theme\SearchPage'
Module not found: Error: Can't resolve '../../utils/generalUtils' in 'C:\Users\DavidL\source\repos\hilltop-docs\content\src\theme\SearchPage'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants