Skip to content

Commit dabbfa7

Browse files
committed
remove unneeded array
1 parent 01b02e6 commit dabbfa7

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

lib/optimize/ModuleConcatenationPlugin.js

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -321,29 +321,27 @@ class ModuleConcatenationPlugin {
321321
}
322322

323323
getImports(module) {
324-
return Array.from(
325-
new Set(
326-
module.dependencies
327-
328-
// Only harmony Dependencies
329-
.filter(dep => dep instanceof HarmonyImportDependency)
330-
331-
// Get reference info for this dependency
332-
.map(dep => dep.getReference())
333-
334-
// Reference is valid and has a module
335-
.filter(ref => ref && ref.module)
336-
337-
// Dependencies are simple enough to concat them
338-
.filter(
339-
ref =>
340-
Array.isArray(ref.importedNames) ||
341-
Array.isArray(ref.module.buildMeta.providedExports)
342-
)
343-
344-
// Take the imported module
345-
.map(ref => ref.module)
346-
)
324+
return new Set(
325+
module.dependencies
326+
327+
// Get reference info only for harmony Dependencies
328+
.map(
329+
dep =>
330+
dep instanceof HarmonyImportDependency ? dep.getReference() : null
331+
)
332+
333+
// Reference is valid and has a module
334+
// Dependencies are simple enough to concat them
335+
.filter(
336+
ref =>
337+
ref &&
338+
ref.module &&
339+
(Array.isArray(ref.importedNames) ||
340+
Array.isArray(ref.module.buildMeta.providedExports))
341+
)
342+
343+
// Take the imported module
344+
.map(ref => ref.module)
347345
);
348346
}
349347

0 commit comments

Comments
 (0)