File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -108,12 +108,26 @@ global.CLOSURE_LOAD_FILE_SYNC = function(src) {
108
108
109
109
// Declared here so it can be used to require base.js
110
110
function nodeGlobalRequire ( file ) {
111
- var _module = global . module , _exports = global . exports ;
111
+ var _module = global . module ,
112
+ _exports = global . exports ,
113
+ exportedRequire = false ;
114
+
112
115
global . module = undefined ;
113
116
global . exports = undefined ;
117
+
118
+ if ( global . require == undefined ) {
119
+ exportedRequire = true ;
120
+ global . require = require ;
121
+ }
122
+
114
123
vm . runInThisContext . call ( global , fs . readFileSync ( file ) , file ) ;
124
+
115
125
global . exports = _exports ;
116
126
global . module = _module ;
127
+
128
+ if ( exportedRequire ) {
129
+ global . require = undefined ;
130
+ }
117
131
}
118
132
119
133
You can’t perform that action at this time.
0 commit comments