fastify-webpack
A fastify plugin for serving webpack bundles. This should be used for development only.
fastify-webpack
is very inspired by webpack-dev-middleware and borrows a lot of code from it's codebase. Thanks to those who contribute to that project.
Usage
Options
index
serverSideRender
Type: boolean
Default: undefined
Instructs the plugin to enable or disable server-side rendering mode. Please see Server-Side Rendering for more information.
Server-Side Rendering
If you're server-side rendering your webpack application, that means you need to render HTML markup on the server before sending it to your clients. During development the HTML to be rendered will be changing whenever you make changes to your application.
fastify-webpack
will create a new bundle(s) for every change to your code using webpack's watch mode. Whenever fastify-webpack
handles a new request, instead of searching for the file within its internal filesystem and serving it via fastify's reply object instead the fastify-webpack
plugin will decorate the request object with the entire bundle's output using hooks.
This streamlines your fastify server-side rendering code during development: