search-index icon indicating copy to clipboard operation
search-index copied to clipboard

Browser: Uncaught SyntaxError: ambiguous indirect export: si

Open eklem opened this issue 1 year ago • 9 comments

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 avatar Oct 10 '23 22:10 eklem

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

eklem avatar Oct 11 '23 06:10 eklem

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

fergiemcdowall avatar Oct 11 '23 12:10 fergiemcdowall

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

eklem avatar Oct 11 '23 12:10 eklem

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

fergiemcdowall avatar Oct 11 '23 12:10 fergiemcdowall

on npm as [email protected]

fergiemcdowall avatar Oct 11 '23 12:10 fergiemcdowall

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 avatar Oct 11 '23 13:10 eklem

You deprecated 5.0.0-rc1 ?

eklem avatar Oct 11 '23 15:10 eklem

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)

fergiemcdowall avatar Oct 12 '23 06:10 fergiemcdowall

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

eklem avatar Oct 13 '23 09:10 eklem