Skip to content

Commit 512a3d7

Browse files
committed
refactor: code
1 parent ac6888f commit 512a3d7

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

lib/Server.js

+5-15
Original file line numberDiff line numberDiff line change
@@ -1993,28 +1993,18 @@ class Server {
19931993

19941994
let isOutputModule = false;
19951995

1996-
if (typeof this.compiler.compilers !== "undefined") {
1997-
this.stats.stats.forEach((stats) => {
1998-
stats.compilation.assetsInfo.forEach((value, key) => {
1999-
const assetExtension = path.extname(key);
2000-
const assetBasename = path.basename(key, assetExtension);
2001-
2002-
if (assetBasename === outputFilename) {
2003-
extension = assetExtension;
2004-
isOutputModule = value.javascriptModule;
2005-
}
2006-
});
2007-
});
2008-
} else {
2009-
this.stats.compilation.assetsInfo.forEach((value, key) => {
1996+
const stats = this.stats.stats ? this.stats.stats : [this.stats];
1997+
1998+
for (const item of stats) {
1999+
for (const [key, value] of item.compilation.assetsInfo) {
20102000
const assetExtension = path.extname(key);
20112001
const assetBasename = path.basename(key, assetExtension);
20122002

20132003
if (assetBasename === outputFilename) {
20142004
extension = assetExtension;
20152005
isOutputModule = value.javascriptModule;
20162006
}
2017-
});
2007+
}
20182008
}
20192009

20202010
if (isOutputModule) {

0 commit comments

Comments
 (0)