-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add package.json exports map #1381
Comments
Adding the exports is interesting, but a breaking change, as exports are all possible files you can use, not just a few you can map. It probably would be interesting to make typescript generate definitions for the algoliasearch-lite.esm.browser build as well (maybe can even be copied from another file?) |
Yes, I meant all files. Is that a problem? The package tree seems small enough:
Maybe an ESM only version of |
Ah you're right, I didn't realise that this package didn't publish it source files, and all exposed files are public. In that case exports could work, but it's still a major version to add most likely. I'll discuss with the team to see what's best |
@Haroenv Just checking in to see if the team discussed this yet? |
cc @shortcuts |
Hey ! We need to do a bit of investigation on how to adapt the Do you have a simple reproduction available? |
@shortcuts The reproduction used to be at https://github.com/kenjonespizza/svelteKit-svelte-algolia-test but I think @kenjonespizza deleted it. I tried just now to recreate the error myself but didn't manage. Do you still have the repo locally by any chance, @kenjonespizza? |
Ah, I managed to see the error again. It's not exactly a minimal reproduction but if you clone this branch https://github.com/janosh/afara/tree/algolia-error install deps and run svelte-kit dev
Pre-bundling dependencies:
svelte
svelte/store
svelte/animate
js-yaml
svelte/transition
(...and 5 more)
(this will be run only when your dependencies or config have changed)
SvelteKit v1.0.0-next.282
local: http://localhost:3000
network: not exposed
Use --host to expose server to other devices on this network
7:55:29 PM [vite] Error when evaluating SSR module /node_modules/algoliasearch/index.js?v=b6e66fba:
ReferenceError: require is not defined
at /node_modules/algoliasearch/index.js?v=b6e66fba:2:23
at instantiateModule (/Users/janosh/Repos/afara/node_modules/vite/dist/node/chunks/dep-971d9e33.js:56177:15) |
Hi! I got this back up. I took down originally because I wasn't sure if env vars should be private... but I want this to be easy for you all to recreate. So, maybe just let me know if those vars should be private and I'll re-roll them in my test account 😅 https://github.com/kenjonespizza/svelteKit-svelte-algolia-test The error I get is:
|
After upgrading to latest SvelteKit that requires vite3, I'm getting this error on dev + build:
I'm importing algoliasesrch via I'm assuming this is related? edit: for anyone who is running into the same issue: my workaround is to import |
I'm getting a similar error with the 5.0.0 alpha client in SvelteKit:
I'm a little stumped by this. The module doesn't seem to have any export at all? |
Thinking to drop algolia for Qwik docs, this issue needs to be fixed asap! |
I'm having trouble using this package with SvelteKit. Listing
algoliasearch
assvelte-algolia
dependency and then attempting to import the latter leads to:See janosh/svelte-algolia#3 for details.
The error disappears when importing
dist/algoliasearch-lite.esm.browser
directly.but then TS complains
I think an easy fix to both these issues would be to add an exports map to your
package.json
in addition to thebrowser
andfiles
fields:as that's what Vite and presumably other ESM bundlers are looking for.
The text was updated successfully, but these errors were encountered: