You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Chunk contents are lost with some values of output.libraryTarget #372
When using global, window, this, commonjs, commonjs2, or assign as output.libraryTarget, chunk contents are not displayed in report. var, umd, 'amd', 'amd-require', 'system', and 'jsonp' work OK.
I'm not yet sure if the outcome for this reproduction is correct or not. The reproduction might need to have more contents in the modules (i.e. no empty source files) to see what's broken.
([function(e,r,t){"use strict";t.r(r);t(1);console.log("This is index.js");},function(e,r){console.log("Hello from module.js");},])
So the report does seem to indicate (with the lack of parsedSize and gzipSize for all files in sub-groups) that webpack-bundle-analyzer is unable to find the modules from the bundle output here.
We might want to incorporate all of the different libraryTarget outputs from Hypnosphi/webpack-bundle-analyzer-repro#1 and test against them, so that we always use the same source files and the only change that happens is what output.libraryTarget is.
Has there been any progress? So far I use source-map-explorer instead, but it's not accurate enough. Hoping to see a bugfix soon, because webpack-bundle-analyzer is very useful :)
Nowadays we're able to test running with different webpack versions.
I'd be happy to see a PR that adds test coverage for all the different libraryTarget values so we could get the infrastructure ready for further bundle parser development ☺️
Verified against current main (23adc7a) with Webpack 5.105.2. A generated Webpack-native UMD fixture contained module IDs 447 and 956, but parseBundle() returned no modules.
Prepending an unrelated zero-argument IIFE with a plausible module map caused the parser to return only decoy ID 999. The parser therefore needs both nested UMD discovery and validation before selecting a candidate. The existing 22 parser tests still pass.
#685 tightened IIFE detection but does not cover this nested shape or competing candidates.
I can submit a focused PR with generated UMD and decoy regression fixtures. I’ll keep its scope to Webpack-native nested UMD discovery and safe candidate validation, without adding sequence-expression support.
Activity
valscion commentedon Jul 22, 2020
Can you add some reproduction steps in the reproduction repository? What commands do I need to run to get to the same result?
Hypnosphi commentedon Jul 22, 2020
npm install && npm run buildvalscion commentedon Jul 23, 2020
I wonder if this is the expected result for
libraryTarget: 'global'. You can however see the full sizes when using "stat" sizes.The output bundle from the reproduction repository looks like so:
Details
The modules part of this bundle is the one after webpack setup code:
And when looking at this, it seems that indeed, only one module content is not blank there.
The webpack stats JSON looks like so:
Details
{ "errors": [ ], "warnings": [ ], "version": "4.43.0", "hash": "275c73f1f4e37ddf824c", "time": 82, "builtAt": 1595486128923, "publicPath": "", "outputPath": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/dist", "assetsByChunkName": { "main": "main.js" }, "assets": [ { "name": "main.js", "size": 995, "chunks": [ 0 ], "chunkNames": [ "main" ], "info": { }, "emitted": true } ], "filteredAssets": 0, "entrypoints": { "main": { "chunks": [ 0 ], "assets": [ "main.js" ], "children": { }, "childAssets": { } } }, "namedChunkGroups": { "main": { "chunks": [ 0 ], "assets": [ "main.js" ], "children": { }, "childAssets": { } } }, "chunks": [ { "id": 0, "rendered": true, "initial": true, "entry": true, "size": 18, "names": [ "main" ], "files": [ "main.js" ], "hash": "226a5b72289872e0254f", "siblings": [ ], "parents": [ ], "children": [ ], "childrenByOrder": { }, "modules": [ { "id": 0, "identifier": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/index.js", "name": "./src/index.js", "index": 0, "index2": 1, "size": 18, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ 0 ], "issuer": null, "issuerId": null, "issuerName": null, "issuerPath": null, "failed": false, "errors": 0, "warnings": 0, "assets": [ ], "reasons": [ { "moduleId": null, "moduleIdentifier": null, "module": null, "moduleName": null, "type": "single entry", "userRequest": "./src", "loc": "main" } ], "usedExports": true, "providedExports": [ ], "optimizationBailout": [ "ModuleConcatenation bailout: Module is an entry point" ], "depth": 0, "source": "import './module'\n" }, { "id": 1, "identifier": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/module.js", "name": "./src/module.js", "index": 1, "index2": 0, "size": 0, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ 0 ], "issuer": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/index.js", "issuerId": 0, "issuerName": "./src/index.js", "issuerPath": [ { "id": 0, "identifier": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/index.js", "name": "./src/index.js" } ], "failed": false, "errors": 0, "warnings": 0, "assets": [ ], "reasons": [ { "moduleId": 0, "moduleIdentifier": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/index.js", "module": "./src/index.js", "moduleName": "./src/index.js", "type": "harmony side effect evaluation", "userRequest": "./module", "loc": "1:0-17" } ], "usedExports": false, "providedExports": null, "optimizationBailout": [ "ModuleConcatenation bailout: Module is not an ECMAScript module" ], "depth": 1, "source": "" } ], "filteredModules": 0, "origins": [ { "module": "", "moduleIdentifier": "", "moduleName": "", "loc": "main", "request": "./src", "reasons": [ ] } ] } ], "modules": [ { "id": 0, "identifier": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/index.js", "name": "./src/index.js", "index": 0, "index2": 1, "size": 18, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ 0 ], "issuer": null, "issuerId": null, "issuerName": null, "issuerPath": null, "failed": false, "errors": 0, "warnings": 0, "assets": [ ], "reasons": [ { "moduleId": null, "moduleIdentifier": null, "module": null, "moduleName": null, "type": "single entry", "userRequest": "./src", "loc": "main" } ], "usedExports": true, "providedExports": [ ], "optimizationBailout": [ "ModuleConcatenation bailout: Module is an entry point" ], "depth": 0, "source": "import './module'\n" }, { "id": 1, "identifier": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/module.js", "name": "./src/module.js", "index": 1, "index2": 0, "size": 0, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ 0 ], "issuer": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/index.js", "issuerId": 0, "issuerName": "./src/index.js", "issuerPath": [ { "id": 0, "identifier": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/index.js", "name": "./src/index.js" } ], "failed": false, "errors": 0, "warnings": 0, "assets": [ ], "reasons": [ { "moduleId": 0, "moduleIdentifier": "/Users/vesa/code/muut/webpack-bundle-analyzer/issue-372-repro/src/index.js", "module": "./src/index.js", "moduleName": "./src/index.js", "type": "harmony side effect evaluation", "userRequest": "./module", "loc": "1:0-17" } ], "usedExports": false, "providedExports": null, "optimizationBailout": [ "ModuleConcatenation bailout: Module is not an ECMAScript module" ], "depth": 1, "source": "" } ], "filteredModules": 0, "logging": { "webpack.buildChunkGraph.visitModules": { "entries": [ ], "filteredEntries": 2, "debug": false } }, "children": [ ] }I'm not yet sure if the outcome for this reproduction is correct or not. The reproduction might need to have more contents in the modules (i.e. no empty source files) to see what's broken.
valscion commentedon Jul 23, 2020
Ok when I put some more contents in the source files like so:
and generate a JSON report with
the generated JSON report looks like this:
[ { "label": "main.js", "isAsset": true, "statSize": 89, "parsedSize": 1062, "gzipSize": 518, "groups": [ { "label": "src", "path": "./src", "statSize": 89, "groups": [ { "id": 0, "label": "index.js", "path": "./src/index.js", "statSize": 52 }, { "id": 1, "label": "module.js", "path": "./src/module.js", "statSize": 37 } ], "parsedSize": 0, "gzipSize": 0 } ] } ]while the bundled output modules looked like so:
So the report does seem to indicate (with the lack of
parsedSizeandgzipSizefor all files in sub-groups) thatwebpack-bundle-analyzeris unable to find the modules from the bundle output here.valscion commentedon Jul 23, 2020
We might want to incorporate all of the different
libraryTargetoutputs from Hypnosphi/webpack-bundle-analyzer-repro#1 and test against them, so that we always use the same source files and the only change that happens is whatoutput.libraryTargetis.hereisfun commentedon Jan 13, 2021
Has there been any progress? So far I use source-map-explorer instead, but it's not accurate enough. Hoping to see a bugfix soon, because webpack-bundle-analyzer is very useful :)
valscion commentedon Jan 14, 2021
Nowadays we're able to test running with different webpack versions.
I'd be happy to see a PR that adds test coverage for all the different☺️
libraryTargetvalues so we could get the infrastructure ready for further bundle parser developmentMenny1337 commentedon Aug 20, 2026
Verified against current
main(23adc7a) with Webpack 5.105.2. A generated Webpack-native UMD fixture contained module IDs447and956, butparseBundle()returned no modules.Prepending an unrelated zero-argument IIFE with a plausible module map caused the parser to return only decoy ID
999. The parser therefore needs both nested UMD discovery and validation before selecting a candidate. The existing 22 parser tests still pass.#685 tightened IIFE detection but does not cover this nested shape or competing candidates.
I can submit a focused PR with generated UMD and decoy regression fixtures. I’ll keep its scope to Webpack-native nested UMD discovery and safe candidate validation, without adding sequence-expression support.