Unbundle dependencies from @docsearch/js
#2224
Labels
Needs investigation
Investigation is planned but not started yet
@docsearch/js
#2224
Description
preact
and@docsearch/react
are listed as dependencies of@docsearch/js
, however, both are inlined into the bundles. This totally breaks any usage of Docsearch on a Preact site as Preact, like React, requires that it be a singleton in order for functionality like hooks to work. Preact being bundled will always result in an additional copy being loaded.This also introduces an additional issue in that most CDNs will try to (helpfully) provide listed
dependencies
of modules. With this setup, that means each of these modules are downloaded twice: once inlined into the bundle, and another time as a separate module. Now this can be worked around in some CDNs, but still isn't ideal, as the default behavior causes wasted network trips.Steps to reproduce
ctrl + f
forxlink
and you'll spot this lineLive reproduction:
N/A
Expected behavior
They're either dependencies or they're bundled, not both.
Environment
The text was updated successfully, but these errors were encountered: