From da950162287acda15f2726205baa897e036f4e50 Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 19:46:50 -0800 Subject: [PATCH] Add a fake `require` to go with the fake `exports`. --- node/utils/Minify.js | 5 ++++- static/pad.html | 3 +++ static/timeslider.html | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/node/utils/Minify.js b/node/utils/Minify.js index 4a22a81f..12efc547 100644 --- a/node/utils/Minify.js +++ b/node/utils/Minify.js @@ -303,8 +303,11 @@ function tarCode(filesInOrder, files, write) { // Wrap the following code in a self executing function and assign exports to // global. This is a first step towards removing symbols from the global scope. +// exports is global and require is a function that returns global. function isolateJS(code) { - return '(function (exports) {'+code+'\n}(function () {return this}()));\n'; + return '(function (exports, require) {' + + code + '\n' + + '}(function () {return this}(), (function (path) {return (function () {return this}())})));\n'; } function compressJS(values) diff --git a/static/pad.html b/static/pad.html index f57438d5..33df2d4f 100644 --- a/static/pad.html +++ b/static/pad.html @@ -18,6 +18,9 @@ + diff --git a/static/timeslider.html b/static/timeslider.html index c1310cc6..71b4443d 100644 --- a/static/timeslider.html +++ b/static/timeslider.html @@ -19,6 +19,8 @@ //