Skip to content

Commit f832ca4

Browse files
committed
Use filename from CLI -o option for the main bundle if available
1 parent 2ba5ac7 commit f832ca4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ module.exports = function webpackStats (b) {
2121
chunkId = 0
2222
}
2323

24+
var mainBundleName = 'bundle.js'
25+
if (b.argv) mainBundleName = b.argv.o || b.argv.outfile || mainBundleName
26+
2427
b.on('reset', addHooks)
2528
b.on('split.pipeline', addChunk)
2629
b.on('factor.pipeline', addChunk)
@@ -29,7 +32,7 @@ module.exports = function webpackStats (b) {
2932
function addHooks () {
3033
init()
3134

32-
addChunk('bundle.js', b.pipeline)
35+
addChunk(mainBundleName, b.pipeline)
3336
b.pipeline.get('wrap').on('end', function () {
3437
require('fs').writeFile('stats.json', JSON.stringify(stats, null, 2), function () {})
3538
})

0 commit comments

Comments
 (0)