Skip to content

Commit

Permalink
Merge pull request #9425 from webpack/bugfix/no-resolve-options
Browse files Browse the repository at this point in the history
fix #9424
  • Loading branch information
sokra committed Jul 17, 2019
2 parents 95d21bb + 1f966eb commit 4cac066
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ResolverFactory.js
Expand Up @@ -10,6 +10,8 @@ const { cachedCleverMerge } = require("./util/cleverMerge");

/** @typedef {import("enhanced-resolve").Resolver} Resolver */

const EMTPY_RESOLVE_OPTIONS = {};

module.exports = class ResolverFactory extends Tapable {
constructor() {
super();
Expand Down Expand Up @@ -40,13 +42,11 @@ module.exports = class ResolverFactory extends Tapable {
return true;
}
});
this.cache1 = new WeakMap();
this.cache2 = new Map();
}

get(type, resolveOptions) {
const cachedResolver = this.cache1.get(resolveOptions);
if (cachedResolver) return cachedResolver();
resolveOptions = resolveOptions || EMTPY_RESOLVE_OPTIONS;
const ident = `${type}|${JSON.stringify(resolveOptions)}`;
const resolver = this.cache2.get(ident);
if (resolver) return resolver;
Expand Down

0 comments on commit 4cac066

Please sign in to comment.