Closed slavafomin closed 5 years ago
@slavafomin -- Webpack 4 is fully supported and tested (along with webpack1-3 -- check out our test fixtures!). Can you give me a minimal repository or codesandbox with install, build, and error reproduction steps so that we can assess and dig in? Thanks!
@ryan-roemer thank you for elaboration.
I've generated the stats file using the BundleAnalyzerPlugin
:
new BundleAnalyzerPlugin({
analyzerMode: 'disabled',
generateStatsFile: true,
statsOptions: 'verbose',
})
Then, I've tried to parse it using CLI: inspectpack -s ./dist/stats.json -a duplicates
.
I'm using webpack 4.35.3
.
Thanks for the additional information. Unfortunately, that still doesn't allow me to reproduce the error on my machine.
Can you create a minimal repository or code sandbox that produces the error with install, build, and reproduction instructions? In lieu of that, some other ideas
dist/stats.json
file you've produced, I can try working on that.And, just as another thought, since the error is inspectpack is finding undefined
at the modules
field, can you try a different stats generating plugin? Or review the shape of the JSON object? (It should have top-level fields of assets
and modules
...
const { StatsWriterPlugin } = require("webpack-stats-plugin");
module.exports = {
// ...
plugins: [
new StatsWriterPlugin({
fields: ["assets", "modules"]
})
]
};
I believe the stats.json
file doesn't contain top-level modules
property. This causing an error in most of the outdated tools out there, including the official analyse
. I was under impression that the file structure of the stats.json
was changed at some point in Webpack, therefore the missing property. If it's not the case, I guess I need to figure out why the modules
property is missing in my generation.
I've tried to use both BundleAnalyzerPlugin
and the Webpack itself (through the API) to generate the stats.json
file using the most extensive preset (verbose
), it should include all possible information.
I will try to generate the file using StatsWriterPlugin
and see if the result will be different.
However, my stats.json
file does has a modules
property, but it's under the chunks[0]
, I've sent the file to you for inspection.
Wow, I've tried to generate the stats.json
file using StatsWriterPlugin
passing null
to the fields
option and the modules
field did appear in the resulted file. I've looked in the Webpack source code and to my astonishment, the modules
property is set to false
in verbose
preset, however, the documentation clearly says: verbose — Output everything
. 😨
Yikes! I totally wouldn't have expected that! (I always use the webpack-stats-plugin
where you manually specify fields, so just haven't come across that yet...)
Does this fix your issue / enable you to use inspectpack
now?
Does this fix your issue / enable you to use inspectpack now?
Yay! It is!
Thanks again :)
I've created an issue with Webpack: https://github.com/webpack/webpack/issues/9392
Hello!
Thank you for this great tool!
However, it looks like it's not compatible with the latest webpack. When I'm trying to analyze the generated
stats.json
file, I'm getting the following error: