Skip to content

Commit

Permalink
When populating ExportMap, only load file if it's not ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
brendo committed Oct 28, 2019
1 parent 112a0bf commit fa64e29
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/ExportMap.js
Expand Up @@ -310,11 +310,18 @@ ExportMap.for = function (context) {
return null
}

// check for and cache ignore
if (isIgnored(path, context)) {
log('ignored path due to ignore settings:', path)
exportCache.set(cacheKey, null)
return null
}

const content = fs.readFileSync(path, { encoding: 'utf8' })

// check for and cache ignore
if (isIgnored(path, context) || !unambiguous.test(content)) {
log('ignored path due to unambiguous regex or ignore settings:', path)
// check for and cache unambigious modules
if (!unambiguous.test(content)) {
log('ignored path due to unambiguous regex:', path)
exportCache.set(cacheKey, null)
return null
}
Expand Down

0 comments on commit fa64e29

Please sign in to comment.