From 86ec3cbc1082e989b7527409d413c772a9573028 Mon Sep 17 00:00:00 2001 From: Glen Mailer Date: Tue, 8 Sep 2015 22:24:35 +0100 Subject: [PATCH] fix: Specify no-transform to avoid buffering As discussed in #10 --- README.md | 8 ++++++++ middleware.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index caffb3e..922c990 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,14 @@ Configuration options can be passed to the client by adding querystring paramete * **overlay** - Set to `false` to disable the DOM-based client-side overlay. * **reload** - Set to `true` to auto-reload the page when webpack gets stuck. +## How it Works + +The middleware installs itself as a webpack plugin, and listens for compiler events. + +Each connected client gets a [Server Sent Events](http://www.html5rocks.com/en/tutorials/eventsource/basics/) connection, the server will publish notifications to connected clients on compiler events. + +When the client receives a message, it will check to see if the local code is up to date. If it isn't up to date, it will trigger webpack hot module reloading. + ## License Copyright 2015 Glen Mailer. diff --git a/middleware.js b/middleware.js index f45fd70..9aa9d39 100644 --- a/middleware.js +++ b/middleware.js @@ -50,7 +50,7 @@ function createEventStream(heartbeat) { res.writeHead(200, { 'Access-Control-Allow-Origin': '*', 'Content-Type': 'text/event-stream;charset=utf-8', - 'Cache-Control': 'no-cache', + 'Cache-Control': 'no-cache, no-transform', 'Connection': 'keep-alive' }); res.write('\n');