algolia / algolia/docsearch

"Named export DocSearch not found" error in Remix framework

Open
#2,259 4 comments 3 reactions 1 assignee Claimed by @dylantientcheu View on GitHub
Needs investigation
Dominant language
TypeScript
Stars
4.4k
Forks
439
Avg merge
14h 32m
Merged PRs (30d)
19

Description

## Description

When importing `DocSearch` React component in Remix framework web app, following error is thrown when running application:

```
[vite] Internal server error: [vite] Named export 'DocSearch' not found. The requested module '@docsearch/react' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@docsearch/react';
const {DocSearch} = pkg;
```

## Steps to reproduce

1. Create Remix app through `npx create-remix@latest`
2. Add `DocSearch` import to `app/routes/_index.tsx`:
```
import { DocSearch } from '@docsearch/react';

import '@docsearch/css';
```
3. Run application in dev mode: `npm run dev`
4. Visit local page: `http://localhost:5173/`

## Expected behavior

Error:
```
Internal server error: [vite] Named export 'DocSearch' not found.
```

should not be produced when running web app in Remix framework. Instead DocSearch search component should be rendered.

## Environment

- OS: Mac
- Browser: Chrome
- DocSearch version: 3.6.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.