Skip to content

Uncaught TypeError: _modernizr2.default.mq is not a function #39

@sonarforte

Description

@sonarforte

I'm using the exact configuration as specified in the Readme, and the import of Modernizr works.

However, when I go to use the thing, I get the error Uncaught TypeError: _modernizr2.default.mq is not a function.

Here is my modernizr config:

{
  "minify": true,
  "options": [
    "setClasses",
    "mq"
  ],
  "feature-detects": []
}

When I use mq, I get the error above. Here is my code:

import Modernizr from 'modernizr'
...
var query = Modernizr.mq('screen and (max-width: 600px)')

Incidentally, if I print out the Modernizr object, I get this:

{
  "minify":true,
  "options": ["setClasses","mq"],
  "feature-detects":[]
}

Where it's quite obvious that mq is not even a direct descendant, let alone a function.

However, this is what the docs say to do, so what gives?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions