-
Notifications
You must be signed in to change notification settings - Fork 499
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
Why does instantsearch require React? #2388
Comments
preact is used internally (with an alias to react), but you should normally not be aware of this as an end-user. Could you share your configuration that causes these error messages so that you're correctly using the production (preact) version? Thanks! |
This is related to #2279 Until we come up with a real fix, you can try to use https://github.com/tleunen/babel-plugin-module-resolver and resolve |
Haroenv, it's a default installation of instantsearch. The site does not use React or Preact for anything. |
I assumed that @millansingh, but this is likely an issue coming up because of a particular setup of build tools that wasn't anticipated before, so for us to find in which use cases this happens exactly would be very useful in replicating and fixing it. Something helpful here is a list of versions used, or even better a reproducible project |
I can't provide something reproducible, since it's a work project. However, I can tell you that we're building front-end files with Gulp and it's within a Laravel instance, using some of Laravel's Elixir Gulp stuff. |
Another workaround would be to use the UMD build in the meantime @millansingh. How do you import InstantSearch.js into your code? |
It's imported by a simple require statement, and downloaded as an npm package. |
* test(babel): alias preact to react for testing purpose * feat(preact): replace `react` and `react-dom` occurences * fix(SLider.Pit): use key to compute pitValue when available * test(widgets): rewire preact now instead of ReactDOM Fix #2279 #2388 I replace `React` and `ReactDOM` by `preact-compat` and fixed the tests which were failing because of the update. I've also replaced Rheostat `React` with `preact-compat` in the fork.
this is still happening, i have to install react and react-dom for it to work
|
Can you make a repository where this happens @hallcyon11? This should be fixed in v2.2.0 |
"instantsearch.js/dist-es5-module/src/widgets/menu-select/menu-select.js" requires react and react-dom and "instantsearch.js/dist-es5-module/src/components/MenuSelect.js" requires react. I changed them to preact-compat and it compiled... |
Oh, you're right, #2460 was merged but not yet released. Can you try |
idk how to do that, i'll just stick with what i have until v2.2.1 is released, thank you for the help. |
just do what i did |
If I change them manually it compiles but Im getting another problem: I saw after doing an Its related to the range slider. Is there any plans of changing this to preact as well? |
Hello, we have just release v2.2.1 which includes the fix 👍 |
Still having this issue from here: And multiple places in rheostat for example here: |
I think that this is fixed now. Please open a new issue if you have issues regarding wrong aliasing of React |
I've installed instantsearch via npm, and it installed fine. However, when I include it in a script and compile the script (with Gulp/Browserify), I get console errors saying that it can't find the 'react' module in various places (like 50 places).
I asked my boss, and he told me to just install react, but I have to wonder why this would use react in the first place, especially when there's a whole separate library specifically for react.
Can someone provide some clarification here on why react is a dependency?
The text was updated successfully, but these errors were encountered: