forked from badNboji/tapered-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtapered-webpack-plugin.js
33 lines (30 loc) · 1.07 KB
/
tapered-webpack-plugin.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
function tapered() {}
tapered.prototype.apply = function(compiler) {
compiler.plugin('emit', function(compilation, callback) {
function unComment() {
const file = compilation.assets['INSERT TEST FILE LOCATION HERE'];
if (file === undefined) {
console.log('file is undefined')
// Refactor with Promises?
setTimeout(function(){unComment}, 1000);
} else if (file) {
console.log('file is defined')
// if (file.source().includes('dabTape')) {
compilation.assets['INSERT TEST FILE LOCATION HERE'] = {
source: function() {
// console.log(file.source());
// remove BadNBojiTape if we move away from multiple file/framework feature
return "const test = require('tape')" + "\n" + file.source().replace(/(\/\*\ ß∂dNß0j1Tape)|(\/\*\ ß∂dNß0j1)|(\*\/)/g,'');
},
size: function() {
return file.source().length;
}
};
// }
}
}
callback();
unComment();
});
};
module.exports = tapered;