Skip to content

Commit c9a6cad

Browse files
committed
export filesystem and invalidate
1 parent 0ddcc35 commit c9a6cad

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

middleware.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ module.exports = function(compiler, options) {
8282

8383
// start watching
8484
if(!options.lazy) {
85-
compiler.watch(options.watchDelay, function(err) {
85+
var watching = compiler.watch(options.watchDelay, function(err) {
8686
if(err) throw err;
8787
});
8888
} else {
@@ -101,7 +101,7 @@ module.exports = function(compiler, options) {
101101
}
102102

103103
// The middleware function
104-
return function webpackDevMiddleware(req, res, next) {
104+
function webpackDevMiddleware(req, res, next) {
105105
// publicPrefix ist the folder our bundle should be in
106106
var localPrefix = options.publicPath || "/";
107107
if(/^https?:\/\//.test(localPrefix)) {
@@ -137,4 +137,12 @@ module.exports = function(compiler, options) {
137137
res.end(content);
138138
}, req);
139139
}
140+
141+
webpackDevMiddleware.invalidate = function() {
142+
if(watching) watching.invalidate();
143+
};
144+
145+
webpackDevMiddleware.fileSystem = fs;
146+
147+
return webpackDevMiddleware;
140148
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack-dev-middleware",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"author": "Tobias Koppers @sokra",
55
"description": "Offers a dev middleware for webpack, which arguments a live bundle to a directory",
66
"peerDependencies": {

0 commit comments

Comments
 (0)