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
If `options.serverSideRender` is true, the middleware will set the `stat` object, which is generated by webpack, to `res`, and all requests will wait for building.
// Turn off the server-side rendering mode. See Server-Side Rendering part for more info.
73
76
}));
74
77
```
75
78
@@ -109,3 +112,18 @@ This part shows how you might interact with the middleware during runtime:
109
112
console.log('Package is in a valid state');
110
113
});
111
114
```
115
+
116
+
## Server-Side Rendering
117
+
In order to develop a server-side rendering application, we need access to the [`stats`](https://github.com/webpack/docs/wiki/node.js-api#stats), which is generated with the latest build.
118
+
119
+
In the server-side rendering mode, __webpack-dev-middleware__ sets the `stat` to `res.locals.webpackStats`, then call `next()` to trigger the next middleware, where we can render pages and response to clients. During the webpack building process, all requests will be pending until the build is finished and the `stat` is available.
0 commit comments