Skip to content

Commit

Permalink
fix test, rollback 1 change
Browse files Browse the repository at this point in the history
  • Loading branch information
konpikwastaken committed Mar 23, 2018
1 parent f822800 commit 684439c
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions packages/node-sass-once-importer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export = function onceImporter() {
store: new Set(),
};

// cache for path resolution
let includePathsCache: Map<string, string[]> = new Map();
// cache for resolvedUrls
let resolvedUrlsCache: Map<string, string> = new Map();

Expand All @@ -35,15 +33,15 @@ export = function onceImporter() {
// would be detected as multiple imports of the same file.
const store = this.nodeSassOnceImporterContext.store;
// per instance of new importer created, path resolution is shared
if (!includePathsCache.has(nodeSassOptions.includePaths)) {
includePathsCache.set(url, buildIncludePaths(
nodeSassOptions.includePaths,
prev,
));
}
const includePaths = includePathsCache.get(nodeSassOptions.includePaths);

if (!resolvedUrlsCache.has(url)){
const includePaths = buildIncludePaths(
nodeSassOptions.includePaths,
prev,
);

// the perf improvement here is avoiding a glob.sync call in resolveUrl
// if we dont need it
if (!resolvedUrlsCache.has(url)) {
resolvedUrlsCache.set(url, resolveUrl(
url,
includePaths,
Expand Down

0 comments on commit 684439c

Please sign in to comment.