Closed SiqiTian-minted closed 7 years ago
version 2.1.5
Can you give any more information? What is throwing that error?
I'm trying to run mocha tests and I'm seeing the same issue as @SiqiTian-minted. My builds started breaking around 3pm mst yesterday but nobody touched anything related to this package.
Hmm it's odd that it's suddenly causing issues. I have made changes to this project in recent days, but that specific line has been the same for years.
Can you provide more details? A reduced test case, or a public repo i can pull and see it happening? Are you tests running in a headless browser? if so, have you tried stubbing out matchMedia?
matchMedia
is not define in node.js environment
matchmedia-polyfill will add it to window, in node this ends up being global.window
So in the browser, matchMedia is like a global, all scopes will eventually get to window. In node, NOT all scopes will go across window.
Looking at the code, I saw some places where it was referring to window.matchMedia. My guess is there are now some places that are only referring to matchMedia, and that will cause a problem running in node with polyfill.
afaik :)
Thanks @mattschlobohm for the suggestion.
I can now work around this problem by polyfilling matchMedia
to both global.window
and global
.
So is there anything I can do to fix this? I'm still not sure why this would have suddenly broke
Using enquire.js@2.1.1
@WickyNilliams
Should be fixed in v2.1.6
. Thanks to @Edward67 for the PR!
Hi, we have saw this new error started today:
The polyfill for
matchMedia
does not work any more. https://github.com/WickyNilliams/enquire.js/issues/82