Skip to content

Commit 7d16ffc

Browse files
committed
watch react on loader dependency
1 parent 0ddf304 commit 7d16ffc

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

lib/execLoaders.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ module.exports = function(context, request, loaders, filenames, contents, cacheE
7878
loaderCacheable = value;
7979
},
8080
dependency: function(filename) {
81+
options.events.emit("dependency", filename);
8182
if(cacheEntry)
8283
cacheEntry.add(filename);
8384
},

lib/webpack.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,14 @@ module.exports = function(context, moduleName, options, callback) {
122122
}));
123123
});
124124

125+
// on before a loader dependency is read
126+
options.events.on("dependency", function(filename) {
127+
if(!filename) return;
128+
watchers.push(fs.watch(filename, function() {
129+
change();
130+
}));
131+
});
132+
125133
// on before a context is enumerated
126134
options.events.on("context", function(module, dirname) {
127135
if(!dirname) return;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack",
3-
"version": "0.4.5",
3+
"version": "0.4.6",
44
"author": "Tobias Koppers @sokra",
55
"description": "Packs CommonJs Modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loading of js, json, jade, coffee, css, ... out of the box and more with custom loaders.",
66
"dependencies": {

0 commit comments

Comments
 (0)