Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rewire.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohannes Ewald <johannes.ewald@peerigon.com>2014-11-04 11:36:40 +0300
committerJohannes Ewald <johannes.ewald@peerigon.com>2014-11-04 11:36:40 +0300
commit09dc5be9128bb07766b01bda9e053046478f9a03 (patch)
tree2923821380c843c74cd5cf9f3b71eae17e945f56 /lib
parent1eede09155581d71bc311e0b7d16e0109d607e05 (diff)
Fix shadowing of internal `module`, `exports` and `require` when a global counterpart exists
@see https://github.com/jhnns/rewire-webpack/pull/6
Diffstat (limited to 'lib')
-rw-r--r--lib/getImportGlobalsSrc.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/getImportGlobalsSrc.js b/lib/getImportGlobalsSrc.js
index 66e69b1..10dfe87 100644
--- a/lib/getImportGlobalsSrc.js
+++ b/lib/getImportGlobalsSrc.js
@@ -16,6 +16,10 @@ function getImportGlobalsSrc(ignore) {
ignore = ignore || [];
// global itself can't be overridden because it's the only reference to our real global objects
ignore.push("global");
+ // ignore 'module', 'exports' and 'require' on the global scope, because otherwise our code would
+ // shadow the module-internal variables
+ // @see https://github.com/jhnns/rewire-webpack/pull/6
+ ignore.push("module", "exports", "require");
for (key in globalObj) { /* jshint forin: false */
if (ignore.indexOf(key) !== -1) {