Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AMD and CommonJS support #155

Open
johanhermansson opened this issue Feb 12, 2015 · 10 comments
Open

AMD and CommonJS support #155

johanhermansson opened this issue Feb 12, 2015 · 10 comments
Assignees

Comments

@johanhermansson
Copy link

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

@attilaolah attilaolah self-assigned this Feb 12, 2015
@k3z
Copy link

k3z commented Jun 12, 2015

+1

@attilaolah
Copy link
Collaborator

👍

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

@k3z
Copy link

k3z commented Jun 12, 2015

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

@jayalfredprufrock
Copy link

+1

@attilaolah
Copy link
Collaborator

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

@pcavanaugh
Copy link

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?

@attilaolah
Copy link
Collaborator

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

@Wtower
Copy link

Wtower commented Apr 12, 2016

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();

@samhavens
Copy link

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.

@el-rotny
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants