Skip to content

Commit 9bdec62

Browse files
committed
Probably the worst form of hiding require programmatically, see #527
1 parent 4462d8b commit 9bdec62

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

dist/protobuf.js

Lines changed: 3 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/protobuf.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/protobuf.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/protobuf.min.js.gz

69 Bytes
Binary file not shown.

dist/protobuf.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/util.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@ util.asPromise = asPromise;
9898
function fetch(path, callback) {
9999
if (!callback)
100100
return asPromise(fetch, util, path);
101-
var fs; try { fs = Function('r', 'return r("fs")')(require); } catch (e) { } // eslint-disable-line no-new-func, no-empty
102-
if (fs && fs.readFile)
103-
return fs.readFile(path, "utf8", callback);
101+
try { return eval(['req','uire'].join(''))("fs").readFile(path, "utf8", callback); } catch (e) { } // eslint-disable-line no-empty, no-eval
104102
var xhr = new XMLHttpRequest();
105103
function onload() {
106104
if (xhr.status !== 0 && xhr.status !== 200)

0 commit comments

Comments
 (0)