Skip to content

Commit

Permalink
Add require patch for node.js
Browse files Browse the repository at this point in the history
  • Loading branch information
xxuejie committed Oct 20, 2013
1 parent 99461ff commit fb81ca5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions js/append/require.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(function () {
// In node.js, the variable `r` below will be undefined after executing
// the following code:
//
// var obj = global;
// var arg = 'require';
// var r = obj[arg];
//
// One guess is that node.js uses special implementation of require.
// For this to work on webruby, we have to add the following patch.
if (!(typeof window === 'object')) {
global['require'] = require;
}
}) ();

0 comments on commit fb81ca5

Please sign in to comment.