algolia / react-instantsearch

⚡️ Lightning-fast search for React and React Native applications, by Algolia.
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/react/
MIT License
1.97k stars 386 forks source link

Fix for webpack warning: Critical dependency: the request of a depend… #3626

Closed DB-Alex closed 1 year ago

DB-Alex commented 1 year ago

…ency is an expression

Use a static dependency import for react-dom using the same code as next.js:

https://github.com/vercel/next.js/blob/6108f10799b46bc0ef97373c913e23714e135942/packages/next/server/render.tsx#L92

Summary

Result

codesandbox-ci[bot] commented 1 year ago

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 9e621529513d3149a64b4cd2ab0731f8e19d8409:

Sandbox Source
react-instantsearch-app Configuration
hooks-example Configuration
netlify[bot] commented 1 year ago

Deploy Preview for react-instantsearch ready!

Name Link
Latest commit 9e621529513d3149a64b4cd2ab0731f8e19d8409
Latest deploy log https://app.netlify.com/sites/react-instantsearch/deploys/63234d89ce2ac70008bbccf2
Deploy Preview https://deploy-preview-3626--react-instantsearch.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Haroenv commented 1 year ago

sorry, but this causes https://github.com/webpack/webpack/issues/13865 to reappear. This does indeed give the "critical dependency", but it's actually on purpose as webpack has a bug and doesn't process conditional imports correctly

Haroenv commented 1 year ago

When renderToString is passed as an argument, this code path can be bypassed, and the error no longer happens. Thanks for your contribution!