Skip to content
This repository was archived by the owner on Nov 15, 2017. It is now read-only.

Commonjs export fix and jshint updates#339

Merged
carhartl merged 1 commit intocarhartl:masterfrom
kvaggelakos:fix-commonjs-export
Mar 18, 2015
Merged

Commonjs export fix and jshint updates#339
carhartl merged 1 commit intocarhartl:masterfrom
kvaggelakos:fix-commonjs-export

Conversation

@kvaggelakos
Copy link
Contributor

Seems like the commonjs export wasn't working. This PR fixed it for me.

@FagnerMartinsBrack
Copy link
Collaborator

What does this PR solves exactly and how is the current behavior without your PR?

@kvaggelakos
Copy link
Contributor Author

It didn't properly export the module before, meaning a require('jquery.cookie') would return {}. This makes sure we actually export the module.

@FagnerMartinsBrack
Copy link
Collaborator

You mean it did not exported correctly in a nodeJS environment, correct?

The factory doesn't return anything, so the return value would not be of any use if that's what you're looking for. You say the inclusion of module.exports is required for it to work in a nodeJS environment? Or just to deal with the returned value?

@kvaggelakos
Copy link
Contributor Author

This is commonjs standard, wether it's for node or browserify that shouldn't matter. In commonjs the module is not returned, it is attached to the module object, which is why in umd we're looking for exports if (typeof exports === 'object') to determine if it's a commonjs environment or not.

carhartl added a commit that referenced this pull request Mar 18, 2015
Commonjs export fix and jshint updates
@carhartl carhartl merged commit d3d4b4a into carhartl:master Mar 18, 2015
@carhartl carhartl mentioned this pull request Mar 19, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants