lara25260's avatar

Webpack .init wow.js as a require ?

Learning webpack with no where else to turn to, the script needs to run new Wow().init (); on the dom, I have used npm to pull the package and require ('wowjs') in the entry path, but I keep getting wow is undefined on the dom.

Anyone can enlighten me ?

0 likes
5 replies
ejdelmonico's avatar

Try attaching it to the window. Try window.WOW = require('wowjs'); in bootstrap.php.

1 like
Aidos's avatar

bootstrap.js

const WOW = require('wowjs'); window.wow = new WOW.WOW({ live: false });

whatever.js

window.wow.init();

3 likes
Kruzhenko's avatar

3 years later still works! 😉👍🏽

1 like

Please or to participate in this conversation.