-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatchDedupe.js
42 lines (41 loc) · 1.4 KB
/
patchDedupe.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var through = require("through2");
exports.patch = function (Browserify) {
Browserify.prototype._dedupe = function () {
return through.obj(function (row, enc, next) {
if (!row.dedupeIndex && row.dedupe) {
// PATCH IS AS SIMPLE AS NOT DOING THE FOLLOWING:
/*
row.source = 'module.exports=require('
+ JSON.stringify(row.dedupe)
+ ')'
;
row.deps = {};
row.deps[row.dedupe] = row.dedupe;
row.nomap = true;
*/
// AND JUST MOVING ON :)
return next();
}
if (row.dedupeIndex && row.sameDeps) {
row.source = 'module.exports=require('
+ JSON.stringify(row.dedupeIndex)
+ ')'
;
row.deps = {};
row.nomap = true;
}
else if (row.dedupeIndex) {
row.source = 'arguments[4]['
+ JSON.stringify(row.dedupeIndex)
+ '][0].apply(exports,arguments)'
;
row.nomap = true;
}
if (row.dedupeIndex && row.dedupe && row.indexDeps) {
row.indexDeps[row.dedupe] = row.dedupeIndex;
}
this.push(row);
next();
});
};
};