remove unused code
This commit is contained in:
Tobias Koppers 2019-07-17 15:38:07 +02:00
parent 95d21bb39a
commit 1f966eb9d0
1 changed files with 3 additions and 3 deletions

View File

@ -10,6 +10,8 @@ const { cachedCleverMerge } = require("./util/cleverMerge");
/** @typedef {import("enhanced-resolve").Resolver} Resolver */ /** @typedef {import("enhanced-resolve").Resolver} Resolver */
const EMTPY_RESOLVE_OPTIONS = {};
module.exports = class ResolverFactory extends Tapable { module.exports = class ResolverFactory extends Tapable {
constructor() { constructor() {
super(); super();
@ -40,13 +42,11 @@ module.exports = class ResolverFactory extends Tapable {
return true; return true;
} }
}); });
this.cache1 = new WeakMap();
this.cache2 = new Map(); this.cache2 = new Map();
} }
get(type, resolveOptions) { get(type, resolveOptions) {
const cachedResolver = this.cache1.get(resolveOptions); resolveOptions = resolveOptions || EMTPY_RESOLVE_OPTIONS;
if (cachedResolver) return cachedResolver();
const ident = `${type}|${JSON.stringify(resolveOptions)}`; const ident = `${type}|${JSON.stringify(resolveOptions)}`;
const resolver = this.cache2.get(ident); const resolver = this.cache2.get(ident);
if (resolver) return resolver; if (resolver) return resolver;