Shopify : How to add infinite scroll to instantsearch for "3.35.1"?

As per this topic - Adding Algolia's infinite scroll to Shopify

I tried to add below snippet.

instant.search.addWidgets([
  instantsearch.widgets.infiniteHits({
    container: '.ais-hits-container',
    hitsPerPage: instant.hitsPerPage,
    templates: {
    },
  })
]);

but it gives me an error as follows.

Uncaught ReferenceError: "instantsearch.widgets" are not available from the ES build.
To import the widgets:
import { searchBox } from 'instantsearch.js/es/widgets'

error

Also, tried to define through external file but still no luck.

var infiniteHits = algolia.externals.widgets.infiniteHits;

Using below

  • Algolia JS version : 3.35.1
  • Shopify App Version: 2.11.5

infi-js