react-instantsearch
react-instantsearch copied to clipboard
instantsearch-hooks-server: use literal imports
Next.js build process (using pnpm) ends up not seeing these import statements cause the import statements didn't have string literals.
The result was that it didn't put these dependencies in the nested node_modules
directory and thus this whole package breaks. Notably this only fails in the production build and not the dev build. See reported bug at next.js.
This change is functionally equivalent, we're just reformatting the code so the literal import statements can be found by whatever tool Next.js is using.
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
Latest deployment of this branch, based on commit b181c45f88783f78809db2720c93a38dbe318d22:
Sandbox | Source |
---|---|
react-instantsearch-app | Configuration |
hooks-example | Configuration |
Deploy Preview for react-instantsearch ready!
Name | Link |
---|---|
Latest commit | b181c45f88783f78809db2720c93a38dbe318d22 |
Latest deploy log | https://app.netlify.com/sites/react-instantsearch/deploys/631baf5b0e69a000075bbc3c |
Deploy Preview | https://deploy-preview-3618--react-instantsearch.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
Argh, it's annoying that this code breaks again, as you can see in the linked issue https://github.com/webpack/webpack/issues/13865. We'll need to investigate this deeply to find the right solution, or possibly make the import user-injected (dependency injection) so it can't have any of these issues.
More specifically it's changed from import statements to expressions in https://github.com/algolia/react-instantsearch/pull/3515
@danielbeardsley, for a workaround you can use patch-package for now I think, is there a way we can reproduce this outside of Vercel?
Maybe my pullrequest will work:
https://github.com/algolia/react-instantsearch/pull/3626
for a workaround you can use patch-package for now I think,
Yeah, we started using pnpm patch
and it seems to be working.