Blame view

node_modules/enhanced-resolve/lib/ModulesInRootPlugin.js 618 Bytes
aaac7fed   liuqimichale   add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  /*
  	MIT License http://www.opensource.org/licenses/mit-license.php
  	Author Tobias Koppers @sokra
  */
  function ModulesInRootPlugin(source, path, target) {
  	this.source = source;
  	this.path = path;
  	this.target = target;
  }
  module.exports = ModulesInRootPlugin;
  
  ModulesInRootPlugin.prototype.apply = function(resolver) {
  	var target = this.target;
  	var path = this.path;
  	resolver.plugin(this.source, function(request, callback) {
  		var obj = Object.assign({}, request, {
  			path: path,
  			request: "./" + request.request
  		});
  		resolver.doResolve(target, obj, "looking for modules in " + path, callback, true);
  	});
  };