# fastify-webpack

> Webpack plugin for server side rendering on fastify

Latest version **0.0.1-alpha.5** (published 2019-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install fastify-webpack
pnpm add fastify-webpack
yarn add fastify-webpack
bun add fastify-webpack
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1-alpha.5 |
| Published | 2019-06-08 |
| First published | 2019-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 25.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sam Faulkner |
| Maintainers | therealsamf |

## Links

- npm: https://www.npmjs.com/package/fastify-webpack
- npm.io page: https://npm.io/package/fastify-webpack

## Dependencies (7)

- [mime](https://npm.io/package/mime.md) ^2.4.1
- [webpack](https://npm.io/package/webpack.md) ^4.29.6
- [memory-fs](https://npm.io/package/memory-fs.md) ^0.4.1
- [proxyquire](https://npm.io/package/proxyquire.md) ^2.1.0
- [fastify-url](https://npm.io/package/fastify-url.md) ^0.2.0
- [range-parser](https://npm.io/package/range-parser.md) ^1.2.0
- [fastify-plugin](https://npm.io/package/fastify-plugin.md) ^1.5.0

## Recent versions

- 0.0.1-alpha.5 (latest) — 2019-06-08
- 0.0.1-alpha.4 — 2019-06-06
- 0.0.1-alpha.3 — 2019-06-06
- 0.0.1-alpha.2 — 2019-06-06
- 0.0.1-alpha.1 — 2019-06-06
- 0.0.1 — 2019-05-04

## README

fastify-webpack
===============

A [fastify](https://www.fastify.io/) plugin for serving [webpack](https://webpack.js.org/) bundles. This should be used for **development** only.

`fastify-webpack` is *very* inspired by [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) and borrows a lot of code from it's codebase. Thanks to [those who contribute](https://github.com/webpack/webpack-dev-middleware/graphs/contributors) 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](#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](https://webpack.js.org/api/node/#watching). Whenever `fastify-webpack` handles a new request, instead of searching for the file within its [internal filesystem](https://www.npmjs.com/package/memory-fs) and serving it via fastify's [reply](https://www.fastify.io/docs/latest/Reply/) object instead the `fastify-webpack` plugin will [decorate](https://www.fastify.io/docs/latest/Decorators/) the [request object](https://www.fastify.io/docs/latest/Request/) with the **entire** bundle's output using [hooks](https://www.fastify.io/docs/latest/Hooks/).

This streamlines your fastify server-side rendering code during development:

* You don't need a separate webpack building process in addition to running your server.
* You don't need something like the [webpack manifest plugin](https://github.com/danethurber/webpack-manifest-plugin) to identify where your bundle(s) is output or named: `fastify-webpack` makes the output identifiable with the [asset's name]](https://webpack.js.org/api/stats#asset-objects).

---
_Source: https://npm.io/package/fastify-webpack · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
