Skip to content

Instantly share code, notes, and snippets.

@tyage
Last active January 25, 2016 07:04
Show Gist options
  • Save tyage/359ec6124d67a80037e8 to your computer and use it in GitHub Desktop.
Save tyage/359ec6124d67a80037e8 to your computer and use it in GitHub Desktop.
var foo = require('./foo');
if (module && module.exports) {
// for use of require('bar')
module.exports = foo;
} else {
// for use of <script src="bar.js"></script>
window.foo = foo;
}
module.exports = 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment