typesense / typesense-instantsearch-adapter

A JS adapter library to build rich search interfaces with Typesense and InstantSearch.js
MIT License
414 stars 64 forks source link

Is the adapter compatible with vite/ESM? #199

Open Mat-moran opened 9 months ago

Mat-moran commented 9 months ago

Description

Hi, when I try to run a page with the react example in a remix route it launches an error image

I think it is related with CJS/ESM

Steps to reproduce

Create a new Remix Vite app: npx create-remix@latest --template remix-run/remix/templates/vite In the index route for example copy the React example code

Expected Behavior

Actual Behavior

The application is broken

Metadata

Typesense Version: Latest

OS: MacOS

Remix v2.8 Vite

grinkus-adapt commented 9 months ago

Not a solution, but a very ugly workaround I found that might help for now:

import TypesenseInstantSearchAdapterExport from "typesense-instantsearch-adapter";
const TypesenseInstantSearchAdapter =
  TypesenseInstantSearchAdapterExport.default ??
  TypesenseInstantSearchAdapterExport;
Mat-moran commented 9 months ago

Thanks you so much, it seems to work.

Let's see if I can make something! 😄

Nedi11 commented 6 months ago

Can we please get a proper fix for this

djdembeck commented 3 months ago

Would like a full fix for this, but I worked around it using https://github.com/cyco130/vite-plugin-cjs-interop