fergiemcdowall / search-index

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

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

Closed eklem closed 2 weeks ago

eklem commented 11 months 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 11 months ago

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

fergiemcdowall commented 11 months ago

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

eklem commented 11 months ago

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

fergiemcdowall commented 11 months ago

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

fergiemcdowall commented 11 months ago

on npm as search-index@5.0.0-rc1

eklem commented 11 months 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 11 months ago

You deprecated 5.0.0-rc1 ?

fergiemcdowall commented 10 months 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 10 months 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 2 weeks 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 2 weeks 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!