Open
Description
openedon Aug 30, 2019
This should prevent bugs like #17165 where a naked reference to window
will crash if used in a SSR context where there's no window
.
See more details in the comment from @jsnajdr #17165 (comment):
In this case, the easiest TDD-style test would be to simply import
@wordpress/compose
in a Node.js environment without DOM. And it would fail.Neither
compose
norcomponents
packages use thesideEffects: false
flag (although they would be a good fit IMO), so using anything fromcompose
bundles the whole library.And the
window
check is a top-level statement in the module. We don't need to use or instantiate theuseReducedMotion
hook at all to get a broken build.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment