GithubHelp home page GithubHelp logo

Comments (10)

m11m avatar m11m commented on June 2, 2024 1

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 :)

from enquire.js.

sytong avatar sytong commented on June 2, 2024 1

Thanks @mattschlobohm for the suggestion.

I can now work around this problem by polyfilling matchMedia to both global.window and global.

from enquire.js.

wwsun avatar wwsun commented on June 2, 2024 1

Using [email protected] @WickyNilliams

from enquire.js.

WickyNilliams avatar WickyNilliams commented on June 2, 2024 1

Should be fixed in v2.1.6. Thanks to @edward67 for the PR!

from enquire.js.

SiqiTian-minted avatar SiqiTian-minted commented on June 2, 2024

version 2.1.5

from enquire.js.

WickyNilliams avatar WickyNilliams commented on June 2, 2024

Can you give any more information? What is throwing that error?

from enquire.js.

EricFreeman avatar EricFreeman commented on June 2, 2024

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.

from enquire.js.

WickyNilliams avatar WickyNilliams commented on June 2, 2024

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?

from enquire.js.

uuid1017 avatar uuid1017 commented on June 2, 2024

matchMedia is not define in node.js environment

from enquire.js.

WickyNilliams avatar WickyNilliams commented on June 2, 2024

So is there anything I can do to fix this? I'm still not sure why this would have suddenly broke

from enquire.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.