Skip to content

Commit

Permalink
Remove not necessary cache
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoVictor committed Oct 10, 2022
1 parent d645e08 commit eb82d27
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/tsc-paths-replacer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ interface ConfigProps extends Record<string, any> {
}

const aliasesMap = new Map();
const sourceModuleCache = new Map();
const moduleCache = new Map();

const config: Record<string, any> = {
Expand All @@ -33,24 +32,12 @@ function getFilesFromPattern(patern: string) {
}

function getModuleRelativePath(
moduleSourcePath: string,
outputFilePath: string
outputFilePath: string,
requiredModulePath: string
) {
if (!sourceModuleCache.has(outputFilePath)) {
sourceModuleCache.set(
outputFilePath,
path.resolve(
config.rootDir,
config.baseUrl,
path.relative(config.outDir, outputFilePath)
)
);
}

const sourceFileFullPath = sourceModuleCache.get(outputFilePath);
const moduleRelativePath = path.relative(
path.dirname(sourceFileFullPath),
moduleSourcePath
path.dirname(outputFilePath),
requiredModulePath
);

return moduleRelativePath.startsWith('.')
Expand Down

0 comments on commit eb82d27

Please sign in to comment.