From 032d90a2075e43aa9be26362a03dae5ffed09878 Mon Sep 17 00:00:00 2001 From: Mohammad Akram <40524561+MDAkramSiddiqui@users.noreply.github.com> Date: Thu, 16 Mar 2023 01:55:03 +0530 Subject: [PATCH] docs(readme): correct dev middleware context usage (#1485) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index aaac6fc1e..e1d0df64a 100644 --- a/README.md +++ b/README.md @@ -398,8 +398,8 @@ In order to develop an app using server-side rendering, we need access to the [`stats`](https://github.com/webpack/docs/wiki/node.js-api#stats), which is generated with each build. -With server-side rendering enabled, `webpack-dev-middleware` sets the `stats` to `res.locals.webpack.devMiddleware.context.stats` -and the filesystem to `res.locals.webpack.devMiddleware.context.outputFileSystem` before invoking the next middleware, +With server-side rendering enabled, `webpack-dev-middleware` sets the `stats` to `res.locals.webpack.devMiddleware.stats` +and the filesystem to `res.locals.webpack.devMiddleware.outputFileSystem` before invoking the next middleware, allowing a developer to render the page body and manage the response to clients. _Note: Requests for bundle files will still be handled by @@ -433,8 +433,8 @@ app.use(middleware(compiler, { serverSideRender: true })); // The following middleware would not be invoked until the latest build is finished. app.use((req, res) => { const { devMiddleware } = res.locals.webpack; - const outputFileSystem = devMiddleware.context.outputFileSystem; - const jsonWebpackStats = devMiddleware.context.stats.toJson(); + const outputFileSystem = devMiddleware.outputFileSystem; + const jsonWebpackStats = devMiddleware.stats.toJson(); const { assetsByChunkName, outputPath } = jsonWebpackStats; // Then use `assetsByChunkName` for server-side rendering