algolia / docsearch

:blue_book: The easiest way to add search to your documentation.
https://docsearch.algolia.com
MIT License
3.98k stars 385 forks source link

import '@docsearch/css' not working in Next.js 13 appDir #1696

Closed trevorpfiz closed 2 months ago

trevorpfiz commented 1 year ago

Description

I am importing @docsearch/css in a layout.tsx file in the /app directory. The CSS is not being loaded.

Steps to reproduce

  1. npm i @docsearch/react
  2. import '@docsearch/css' in layout.tsx
  3. import { DocSearch } from '@docsearch/react' in page.tsx
  4. See error

Expected behavior

I would expect it to work the same as in _app.tsx in the /pages directory.

Environment

trevorpfiz commented 1 year ago

My temporary fix is to duplicate the style.css file from @docsearch/css and import '#/styles/style.css' in layout.tsx.

8bittitan commented 1 year ago

Hi @trevorpfiz are you still seeing this issue by chance?

807573212 commented 5 months ago

This may help. npm install @docsearch/js @docsearch/css

levimichael commented 2 months ago

Closing -- a fresh install of Next.js and Docsearch shows this working as expected. Feel free to open a new issue if this persists.