admin管理员组

文章数量:1241099

when I try to require WOW by one of those statements

global.WOW = require('wowjs');
var WOW = require('wowjs');
window.WOW = require('wowjs');

I receive this error

jQuery.Deferred exception: WOW is not a constructor TypeError: WOW is not a constructor

when I try to require WOW by one of those statements

global.WOW = require('wowjs');
var WOW = require('wowjs');
window.WOW = require('wowjs');

I receive this error

jQuery.Deferred exception: WOW is not a constructor TypeError: WOW is not a constructor

Share Improve this question edited Mar 26, 2018 at 12:46 Carol Skelly 363k91 gold badges735 silver badges646 bronze badges asked Apr 13, 2017 at 12:27 Ali TurkiAli Turki 1,4752 gold badges17 silver badges21 bronze badges 6
  • try importing jQuery before using wowjs – Radinator Commented Apr 13, 2017 at 12:29
  • I already did it – Ali Turki Commented Apr 13, 2017 at 12:31
  • Ya, I think it would be tough to get a jQuery.Deferred exception if you didn't have jQuery yet. – takendarkk Commented Apr 13, 2017 at 12:33
  • Try var Wow = require('wowjs').default; – Linus Borg Commented Apr 13, 2017 at 12:40
  • it still doesn't work – Ali Turki Commented Apr 13, 2017 at 12:46
 |  Show 1 more ment

3 Answers 3

Reset to default 13

try this one

const WOW = require('wowjs');

window.wow = new WOW.WOW({
    live: false
});

window.wow.init();

the module exports an object, you need to use the WOW constructor in that object. Eg. require('wowjs').WOW

You need to use wow.js instead of wowjs in React

npm install wow.js

and in your code

import WOW from 'wow.js'

useEffect(() => {
    const wow = new WOW({ live: false }) // disables sync requirement
    wow.init()
}, [])

本文标签: javascriptWOW is not a constructorStack Overflow