From dabbfa7c4e8f38b9cea8f4e964a47d03b4719a08 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 8 Jun 2018 13:21:18 +0200 Subject: [PATCH] remove unneeded array --- lib/optimize/ModuleConcatenationPlugin.js | 38 +++++++++++------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/optimize/ModuleConcatenationPlugin.js b/lib/optimize/ModuleConcatenationPlugin.js index 97e23e02b..24710016f 100644 --- a/lib/optimize/ModuleConcatenationPlugin.js +++ b/lib/optimize/ModuleConcatenationPlugin.js @@ -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) ); }