ソースを参照

adjust UMD for CommonJS/Node

Adam Shaw 11 年 前
コミット
3e13094829
3 ファイル変更7 行追加0 行削除
  1. 3 0
      build/jshint.conf.js
  2. 3 0
      src/intro.js
  3. 1 0
      src/outro.js

+ 3 - 0
build/jshint.conf.js

@@ -5,6 +5,9 @@ module.exports = {
 		globals: {
 			// `false` means read-only
 			define: false,
+			exports: false,
+			module: false,
+			require: false,
 			moment: false,
 			jQuery: false
 		},

+ 3 - 0
src/intro.js

@@ -8,6 +8,9 @@
 	if (typeof define === 'function' && define.amd) {
 		define([ 'jquery', 'moment' ], factory);
 	}
+	else if (typeof exports === 'object') { // Node/CommonJS
+		module.exports = factory(require('jquery'), require('moment'));
+	}
 	else {
 		factory(jQuery, moment);
 	}

+ 1 - 0
src/outro.js

@@ -1,2 +1,3 @@
 
+return fc; // export for Node/CommonJS
 });