Reputation: 13
I'm on a Vue-cli project and I got an issue with Modernizr.addTest()
:
Uncaught TypeError: Modernizr.addtest is not a function.
I downloaded Modernizr with the addTest()
option.
Here my case :
const Modernizr = require('../vendors/modernizr-custom');
export class DeviceManager {
constructor() {
this.userAgent = '';
this.init();
}
init() {
this.userAgent = navigator.userAgent.toLowerCase();
console.log(this.userAgent);
Modernizr.addTest('webkit',function(){return !!this.userAgent.match(/Android/i);});
}
}
My class is called correctly, I got my console.log
in the console dev on Chrome.
Can you see something wrong?
Upvotes: 1
Views: 1095
Reputation: 3871
Uncaught TypeError: Modernizr.addtest is not a function.
is shown when you are calling the Modernizr
method that is not present. Modernizr
itself is present (otherwise it would be ReferenceError: ...not defined
).
It looks like your Modernizr
build does not include addTest
as an option. Beware of that; when you are building Modernizr
from official website this option is off by default.
Upvotes: 1