Closed grinkus-adapt closed 10 months ago
kiliman went around the issue by using crypto-js
instead of crypto
in a comment on https://github.com/remix-run/remix/issues/7095#issuecomment-1668355646. Maybe that's the way to go?
This is an issue in Remix due to our Node polyfills plugin overriding esbuild's package.json browser
field support. I've submitted a PR fixing this upstream: https://github.com/imranbarbhuiya/esbuild-plugins-node-modules-polyfill/pull/150. I think this PR can be closed.
This is an issue in Remix due to our Node polyfills plugin overriding esbuild's package.json
browser
field support. I've submitted a PR fixing this upstream: imranbarbhuiya/esbuild-plugins-node-modules-polyfill#150. I think this PR can be closed.
Using v1.5
of esbuild-plugins-node-modules-polyfill
fixes the issue and crypto
is no longer included in the browser bundle.
Description
I am not sure if it's the adapter or Remix doing something funky, but it seems that
crypto
is being polyfilled because of it's use in thetypesense-instantsearch-adapter
.I've created two repositories to reproduce the issue. One uses Next.js, the other uses Remix. They have three pages each: a simple page without search, a page that uses algolia's instantsearch using algolia and a page that uses algolia's instantsearch using typesense via the adapter. The largest bundle on the adapter-search page on Next.js is at about 300 kb, while on Remix the largest bundle is at a whopping 1.7 mb. I've added screenshots of the
Coverage
panel of each of the pages in the readme files on each of the repro repositories.Behavior
Looking at the bundle analyzer chart that's generated by uploading the metafile it seems that
crypto
is being polyfilled because of it's use in thetypesense-instantsearch-adapter
Coverage of Next.js version
Coverage of Remix version