Skip to content

Commit 4c948e9

Browse files
committed
Remove an unecessary promise wrapper
1 parent 2b41272 commit 4c948e9

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

src/viewer.js

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -132,29 +132,23 @@ async function generateReport(bundleStats, opts) {
132132

133133
if (!chartData) return;
134134

135-
await new Promise((resolve, reject) => {
136-
try {
137-
const reportHtml = renderViewer({
138-
mode: 'static',
139-
title: resolveTitle(reportTitle),
140-
chartData,
141-
defaultSizes,
142-
enableWebSocket: false
143-
});
144-
const reportFilepath = path.resolve(bundleDir || process.cwd(), reportFilename);
145-
146-
fs.mkdirSync(path.dirname(reportFilepath), {recursive: true});
147-
fs.writeFileSync(reportFilepath, reportHtml);
148-
149-
logger.info(`${bold('Webpack Bundle Analyzer')} saved report to ${bold(reportFilepath)}`);
135+
const reportHtml = renderViewer({
136+
mode: 'static',
137+
title: resolveTitle(reportTitle),
138+
chartData,
139+
defaultSizes,
140+
enableWebSocket: false
141+
});
142+
const reportFilepath = path.resolve(bundleDir || process.cwd(), reportFilename);
150143

151-
if (openBrowser) {
152-
open(`file://${reportFilepath}`, logger);
153-
}
154-
resolve();
155-
} catch (e) {
156-
reject(e);
157-
}
144+
fs.mkdirSync(path.dirname(reportFilepath), {recursive: true});
145+
fs.writeFileSync(reportFilepath, reportHtml);
146+
147+
logger.info(`${bold('Webpack Bundle Analyzer')} saved report to ${bold(reportFilepath)}`);
148+
149+
if (openBrowser) {
150+
open(`file://${reportFilepath}`, logger);
151+
}
158152
});
159153
}
160154

0 commit comments

Comments
 (0)