Skip to content

Commit

Permalink
remove cache
Browse files Browse the repository at this point in the history
  • Loading branch information
vankop committed Apr 4, 2022
1 parent 13b769a commit 5d90d19
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions lib/AliasPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,12 @@ module.exports = class AliasPlugin {
*/
apply(resolver) {
const target = resolver.ensureHook(this.target);
const cache = {};
const getAbsolutePathWithSlashEnding = maybeAbsolutePath => {
if (cache[maybeAbsolutePath] === undefined) {
const type = getType(maybeAbsolutePath);
if (type === PathType.AbsolutePosix || type === PathType.AbsoluteWin) {
cache[maybeAbsolutePath] = resolver
.join(maybeAbsolutePath, "_")
.slice(0, -1);
} else {
cache[maybeAbsolutePath] = null;
}
const type = getType(maybeAbsolutePath);
if (type === PathType.AbsolutePosix || type === PathType.AbsoluteWin) {
return resolver.join(maybeAbsolutePath, "_").slice(0, -1);
}
return cache[maybeAbsolutePath];
return null;
};
const isSubPath = (path, maybeSubPath) => {
const absolutePath = getAbsolutePathWithSlashEnding(maybeSubPath);
Expand Down

0 comments on commit 5d90d19

Please sign in to comment.