Skip to content

Commit 431a72f

Browse files
committed
fix: fixed --ignore in cases like --transitiveOnly
1 parent 88f1046 commit 431a72f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

lib/analyze.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,12 @@ const buildModuleDepsChains = (modules, name) => {
226226
}, []);
227227
};
228228

229-
const postProcessModules = modules => {
229+
const postProcessModules = (modules, ignore) => {
230230
return Object.keys(modules).reduce((acc, name) => {
231+
if (mm.isMatch(name, ignore)) {
232+
return acc;
233+
}
234+
231235
const module = modules[name];
232236
if (module.type === "module") {
233237
module.locations = Array.from(new Set(module.locations));
@@ -242,7 +246,7 @@ const postProcessModules = modules => {
242246
}
243247

244248
module.reasons = module.reasons.filter(
245-
reason => !!modules[reason.moduleName]
249+
reason => !mm.isMatch(reason.clearName || reason.moduleName, ignore)
246250
);
247251

248252
if (module.reasons.length) {
@@ -257,12 +261,7 @@ module.exports = function analyze(
257261
ignore /*: Array<string> */ = []
258262
) {
259263
const rawModules = flattenChunks(stats);
260-
const modules = pickFromModules(rawModules).filter(
261-
m =>
262-
!mm.isMatch(
263-
m.clearName || m.name,
264-
[].concat(DEFAULT_IGNORE).concat(ignore)
265-
)
266-
);
267-
return toArray(postProcessModules(joinModules(modules)));
264+
const ignorePatterns = [].concat(DEFAULT_IGNORE).concat(ignore);
265+
const modules = pickFromModules(rawModules);
266+
return toArray(postProcessModules(joinModules(modules), ignorePatterns));
268267
};

0 commit comments

Comments
 (0)