remove unneeded array

This commit is contained in:
Tobias Koppers 2018-06-08 13:21:18 +02:00
parent 01b02e6e49
commit dabbfa7c4e
1 changed files with 18 additions and 20 deletions

View File

@ -321,29 +321,27 @@ class ModuleConcatenationPlugin {
}
getImports(module) {
return Array.from(
new Set(
module.dependencies
return new Set(
module.dependencies
// Only harmony Dependencies
.filter(dep => dep instanceof HarmonyImportDependency)
// Get reference info only for harmony Dependencies
.map(
dep =>
dep instanceof HarmonyImportDependency ? dep.getReference() : null
)
// Get reference info for this dependency
.map(dep => dep.getReference())
// Reference is valid and has a module
// Dependencies are simple enough to concat them
.filter(
ref =>
ref &&
ref.module &&
(Array.isArray(ref.importedNames) ||
Array.isArray(ref.module.buildMeta.providedExports))
)
// Reference is valid and has a module
.filter(ref => ref && ref.module)
// Dependencies are simple enough to concat them
.filter(
ref =>
Array.isArray(ref.importedNames) ||
Array.isArray(ref.module.buildMeta.providedExports)
)
// Take the imported module
.map(ref => ref.module)
)
// Take the imported module
.map(ref => ref.module)
);
}