fergiemcdowall / search-index

A persistent, network resilient, full text search library for the browser and Node.js
MIT License
1.39k stars 149 forks source link

Browser: Uncaught SyntaxError: ambiguous indirect export: si #618

Closed eklem closed 3 months ago

eklem commented 1 year ago

Hi @fergiemcdowall! I'm trying to import the ESM-version to run in the browser, but not sure what's exported from search-index-esm-4.0.0.js?

In HTML:

<script type="module" src="./geo-search-app.mjs"></script>

In geo-search-app.mjs

import { si } from './search-index-esm-4.0.0.js'
const idx = await si()

Then I get an error-message, saying

Uncaught SyntaxError: ambiguous indirect export: si

That's why I'm wondering what search-index is exported as?

eklem commented 1 year ago

But the ESM-version is maybe only made for NodeJS and not the browser?

fergiemcdowall commented 1 year ago

I think it should just be available as a global variable SearchIndex :)

eklem commented 1 year ago

It is in search-index-4.0.0.js (UMD), but not the ESM - search-index-esm-4.0.0.js

fergiemcdowall commented 1 year ago

Ah right yes. In the newest version, it is ESM compatible by default.

fergiemcdowall commented 1 year ago

on npm as search-index@5.0.0-rc1

eklem commented 1 year ago

If that works, I can also start on a simple service worker for seach-index, importing the different things you need into the service worker. I'll test it later today.

eklem commented 1 year ago

You deprecated 5.0.0-rc1 ?

fergiemcdowall commented 1 year ago

I can't remember exactly why I did that, but I probably published it as the latest version by accident, and then depredated it in a panic just to make sure that nobody actually used it! (strictly speaking it should be published with tag: next)

eklem commented 1 year ago

Is it possible with a 5.0.0-rc2 with the next tag? So i can play around with the geo-search-helper demo =)

fergiemcdowall commented 3 months ago

Sorry that I missed that last question @eklem !

search-index@5.0.0 is now out and this should all just work (let me know if it doesnt 🙂)

eklem commented 3 months ago

Nice. I have a simple geo-search demo I want to build. And I want to slowly learn how to use it with a service worker. So now it is!