Incorrect stats position field in res object
MDAkramSiddiqui opened this issue · comments
Documentation Is: ReadMe file
- Missing
- Needed
- Confusing
- Not Sure?
Please Explain in Detail...
this paragraph is mentioned in the ReadMe file to access stats but checked in code the stats field is not present inside devMiddleware.context.stats
but in devMiddleware.stats
const { devMiddleware } = res.locals.webpack;
const outputFileSystem = devMiddleware.context.outputFileSystem;
const jsonWebpackStats = devMiddleware.context.stats.toJson();
const { assetsByChunkName, outputPath } = jsonWebpackStats;
Your Proposal for Changes
Either update the code or ReadMe.
const { devMiddleware } = res.locals.webpack;
const outputFileSystem = devMiddleware.outputFileSystem;
const jsonWebpackStats = devMiddleware.stats.toJson();
const { assetsByChunkName, outputPath } = jsonWebpackStats;
Feel free to send a fix to docs, just use devMiddleware.context.stats
This is what I am saying cannot use stats via this devMiddleware.context.stats
as context is undefined.
@MDAkramSiddiqui When you try to get this? Becaue it can be undefined if no builds happend
Talking about this line, devMiddleware
is context
itself, @alexander-akait
webpack-dev-middleware/src/middleware.js
Line 88 in 9d1edd4
Do you have middleware after webpack-dev-middleware? Anyway can you create minimum reproducible test repo, because I can't undestand there is place where you try to get it, thank you
yes, I have a middleware after webpack-dev-middleware where I read assets, for that I am reading devMiddleware.stats
.
I am not saying it is a bug, just that readme doc is not correct as per this line of code.
Oh, I see, do you want to send a PR with fix?
cannot raise a PR, getting error that I don't have permission.
You need fork firstly, then send a PR to your fork and then go to PR requests and send it
thanks, have raised the PR #1485