Skip to content

Commit

Permalink
refactor: code
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Sep 25, 2021
1 parent ac6888f commit 512a3d7
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions lib/Server.js
Expand Up @@ -1993,28 +1993,18 @@ class Server {

let isOutputModule = false;

if (typeof this.compiler.compilers !== "undefined") {
this.stats.stats.forEach((stats) => {
stats.compilation.assetsInfo.forEach((value, key) => {
const assetExtension = path.extname(key);
const assetBasename = path.basename(key, assetExtension);

if (assetBasename === outputFilename) {
extension = assetExtension;
isOutputModule = value.javascriptModule;
}
});
});
} else {
this.stats.compilation.assetsInfo.forEach((value, key) => {
const stats = this.stats.stats ? this.stats.stats : [this.stats];

for (const item of stats) {
for (const [key, value] of item.compilation.assetsInfo) {
const assetExtension = path.extname(key);
const assetBasename = path.basename(key, assetExtension);

if (assetBasename === outputFilename) {
extension = assetExtension;
isOutputModule = value.javascriptModule;
}
});
}
}

if (isOutputModule) {
Expand Down

0 comments on commit 512a3d7

Please sign in to comment.