Skip to content

Commit 5972b45

Browse files
committed
fix chunk stats generation with split-require
1 parent 147740a commit 5972b45

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = function webpackStats (b, opts) {
2828
if (b.argv) mainBundleName = b.argv.o || b.argv.outfile || mainBundleName
2929

3030
b.on('reset', addHooks)
31-
b.on('split.pipeline', addChunk)
31+
b.on('split.pipeline', function (pipeline, row, name) { addChunk(name, pipeline) })
3232
b.on('factor.pipeline', addChunk)
3333
addHooks()
3434

@@ -59,7 +59,9 @@ module.exports = function webpackStats (b, opts) {
5959
pipeline.get('wrap').push(through(ondata, onchunkend))
6060

6161
function onmodule (row, enc, cb) {
62-
var relative = path.relative(b._options.basedir || process.cwd(), row.file)
62+
var relative = !row.file
63+
? '(generated)/' + row.id
64+
: path.relative(b._options.basedir || process.cwd(), row.file)
6365
var match = /^(\.\.\/)+(.*?)\/browserify\/(lib|node_modules)\//.exec(relative)
6466
if (match) {
6567
relative = '(browserify)/' + match[3] + '/' + relative.slice(match[0].length)

0 commit comments

Comments
 (0)