lepu-test-platform-web/node_modules/enhanced-resolve/lib/FileKindPlugin.js

20 lines
550 B
JavaScript
Raw Normal View History

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function FileKindPlugin(source, target) {
this.source = source;
this.target = target;
}
module.exports = FileKindPlugin;
FileKindPlugin.prototype.apply = function(resolver) {
var target = this.target;
resolver.plugin(this.source, function(request, callback) {
if(request.directory) return callback();
var obj = Object.assign({}, request);
delete obj.directory;
resolver.doResolve(target, obj, null, callback);
});
};