Skip to content

Commit

Permalink
Fix viewer.js tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Aug 2, 2023
1 parent 867e276 commit f162c20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/analyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function getViewerData(bundleStats, bundleDir, opts) {
// Sometimes all the information is located in `children` array (e.g. problem in #10)
if (
(bundleStats.assets == null || bundleStats.assets.length === 0)
&& bundleStats.children.length > 0
&& bundleStats.children && bundleStats.children.length > 0
) {
const {children} = bundleStats;
bundleStats = bundleStats.children[0];
Expand All @@ -41,7 +41,7 @@ function getViewerData(bundleStats, bundleDir, opts) {
bundleStats.assets.push(asset);
});
}
} else if (bundleStats.children.length > 0) {
} else if (bundleStats.children && bundleStats.children.length > 0) {
// Sometimes if there are additional child chunks produced add them as child assets
bundleStats.children.forEach((child) => {
child.assets.forEach((asset) => {
Expand Down

0 comments on commit f162c20

Please sign in to comment.