-
Notifications
You must be signed in to change notification settings - Fork 224
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
[bug]: React Native: Unable to resolve module http from node_modules/@algolia/requester-node-http/src/createHttpRequester.ts: #1554
[bug]: React Native: Unable to resolve module http from node_modules/@algolia/requester-node-http/src/createHttpRequester.ts: #1554
Comments
Hey, the client should still be compatible but it leverages package.json#exports field, which is an opt-in metro option Does it make it work if you enable it? |
Does not work. It crashes elsewhere which isn't surprising, given that is an unstable and experimental feature. |
@shortcuts, you can probably add a as a workaround for now you can of course use v4 still @giantslogik or add an alias to the browser entry point |
@Haroenv can you elaborate on add an alias to the browser entry point. I'm migrating away from v4 as it subtly broke my React Native environment by introducing dom types into the react native typescript environment. |
Yes, it uses the old package.json entrypoints so it should work by default with rn
Definitely, mostly @Haroenv suggested, but I was wondering it this could just stay on the bundler side rather than the library side
yup it seems like a requirement, I'll try to see on the expo side as well if there's a consensus before |
@shortcuts It can't stay on the bundler side, as any bundler options would need to be compatible with every commonly used react native library out there. And it shouldn't need an experimental /unstable feature . There are other issues with React native support that i will ticket as well. (that have existed from 4.x atleast ) |
I am experiencing the same bug. |
Downgrading to "algoliasearch": "^5.2.3" has resolved the issue. |
hey @InefableKoumba thanks for reporting :) as per their doc, the browser field at the root is looked up when resolving modules, so algolia/api-clients-automation#3767 should provide a fix for this! |
Hey, 5.5.0 should have this fixed :) |
Hey there! 5.5.0 version does not fix the bug for me |
@FXStreetDeveloper, do you still get the same error message? maybe a repo that can be reproduced? |
This is the error I have:
The code: import { liteClient as algoliasearch } from 'algoliasearch/lite';
// Other piece of code...
const searchClient = useMemo(() => {
return algoliasearch(algoliaConfig.appId, algoliaConfig.key);
}, [algoliaConfig.appId, algoliaConfig.key]); And the dependencies: {
"@algolia/client-search": "^5.5.0",
"instantsearch.css": "^8.5.1",
"react-instantsearch-core": "^7.13.1",
"react-native": "0.74.5",
"expo": "~51.0.32"
} |
ahhhhh I guess this https://github.com/algolia/algoliasearch-client-javascript/blob/main/packages/algoliasearch/package.json#L62 should be {
"react-native": {
".": "./dist/browser.js",
"./lite": "./dist/lite/builds/browser.js"
}
} |
Alright, so a new fix must be submitted I guess? Thanks for the quick reply! |
yup I think algolia/api-clients-automation#3771 should do it, thanks for testing it :D |
hey, i'm releasing the fix in 5.5.1 |
It works like a charm! Just had to clean the ios/android/node_modules folders to make it work. Thanks for the quick fix! |
Description
With
"algoliasearch": "^5.4.3",
"react-instantsearch-core": "^7.13.1",
"react-native": "0.73.6"
the algolia client fails with:
This worked previously with "algoliasearch": "^4.23.3" and "react-instantsearch-hooks": "^6.33.0"
It appears that the algoliasearch 5 , package is no longer compatible with react native.
This is the same error as #1547 which is incorrectly closed.
Client
Search
Version
5.4.3
Relevant log output
The text was updated successfully, but these errors were encountered: