WOW icon indicating copy to clipboard operation
WOW copied to clipboard

AMD and CommonJS support

Open johanhermansson opened this issue 10 years ago • 10 comments

Would be sweet with AMD and CommonJS support for Browserify :) The UMD method is nice https://github.com/umdjs/umd

johanhermansson avatar Feb 12 '15 09:02 johanhermansson

+1

k3z avatar Jun 12 '15 14:06 k3z

:+1:

I also prefer the UDM way. If anyone's up for some coding, PRs are welcome as always.

attilaolah avatar Jun 12 '15 14:06 attilaolah

I found this sample code in a french post that seems to be universal. http://putaindecode.fr/posts/js/browserify-all-the-things/#ecrire-un-module-pour-browserify-mais-pas-que

k3z avatar Jun 12 '15 14:06 k3z

+1

jayalfredprufrock avatar Jul 21 '15 00:07 jayalfredprufrock

Could you please try the amd branch and see if that works for you? If yes, we could merge that.

attilaolah avatar Aug 19 '15 14:08 attilaolah

Hi @attilaolah, the amd branch is working for me with one exception. When using browserify, the global this object is not equal to window, so the browser function checks for MutationObserver and WeakMap fail. Would it be possible to explicitly reference the window object in those places?

pcavanaugh avatar Sep 23 '15 22:09 pcavanaugh

Yes, we can do that (explicitly reference window).

attilaolah avatar Oct 17 '15 20:10 attilaolah

I am not entirely sure how relevant the following is regarding the present issue, but here is how I used browserify-shim to get wow work with browserify, in case somebody lands here looking for help:

$ npm install -D browserify browserify-shim wow.js

package.json append:

"browserify": {
  "transform": [ "browserify-shim" ]
},
"browser": {
  "wow": "./node_modules/wow.js/dist/wow.js"
},
"browserify-shim": {
  "wow": {"exports": "WOW"}
}

index.js:

var WOW = require('wow');
new WOW().init();

Wtower avatar Apr 12 '16 12:04 Wtower

To echo what @pcavanaugh said, to get WOW working with Browserify, I had to download the AMD branch, then change a few thiss to window to get it to work.

samhavens avatar Jul 26 '16 21:07 samhavens

I can confirm what @Wtower posted with no need to do an extra steps. Using Gulp to compile this project.

rg-najera avatar Dec 30 '17 23:12 rg-najera