Skip to content
This repository was archived by the owner on Nov 5, 2019. It is now read-only.

Commit 60e7cec

Browse files
committed
Don't crash in environments without window
1 parent 692e9c7 commit 60e7cec

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

addScript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Author Tobias Koppers @sokra
44
*/
55
module.exports = function(src) {
6-
if (window.execScript)
7-
window.execScript(src);
6+
if (typeof execScript === "function")
7+
execScript(src);
88
else
99
eval.call(null, src);
1010
}

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ var path = require("path");
66
module.exports = function() {};
77
module.exports.pitch = function(remainingRequest) {
88
this.cacheable && this.cacheable();
9-
return "require(" + JSON.stringify("!" + path.join(__dirname, "addScript.js")) + ")"+
9+
return "require(" + JSON.stringify("!!" + path.join(__dirname, "addScript.js")) + ")"+
1010
"(require(" +
11-
JSON.stringify("!" + require.resolve("raw-loader") + "!" + remainingRequest) + ")" +
11+
JSON.stringify("!!" + require.resolve("raw-loader") + "!" + remainingRequest) + ")" +
1212
(this.debug ?
1313
"+" +
1414
JSON.stringify(

0 commit comments

Comments
 (0)