|
1 | 1 | /* jshint node:true */ |
2 | | -const { statSync } = require('fs'); |
| 2 | +var statSync = require('fs').statSync; |
3 | 3 | var lr = require('tiny-lr'); |
4 | 4 | var servers = {}; |
5 | 5 |
|
@@ -54,35 +54,35 @@ LiveReloadPlugin.prototype.start = function start(watching, cb) { |
54 | 54 | }; |
55 | 55 |
|
56 | 56 | LiveReloadPlugin.prototype.done = function done(stats) { |
57 | | - this.changedFiles = Object.keys(stats.compilation.fileTimestamps).filter(watchfile => { |
| 57 | + this.changedFiles = Object.keys(stats.compilation.fileTimestamps).filter(function(watchfile) { |
58 | 58 | return this.startTime < Math.ceil(statSync(watchfile).mtime); |
59 | | - }); |
| 59 | + }.bind(this)); |
60 | 60 |
|
61 | 61 | this.startTime = Date.now(); |
62 | 62 |
|
63 | | - const { assets } = stats.compilation; |
| 63 | + var assets = stats.compilation.assets; |
64 | 64 | const include = []; |
65 | 65 |
|
66 | | - this.changedFiles.forEach(changedFile => { |
67 | | - Object.keys(assets).forEach(assetName => { |
| 66 | + this.changedFiles.forEach(function(changedFile) { |
| 67 | + Object.keys(assets).forEach(function(assetName) { |
68 | 68 | const asset = Object.assign({}, assets[assetName]); |
69 | 69 | const sources = []; |
70 | 70 |
|
71 | 71 | if (asset.emitted && asset.existsAt.split('.').slice(-1)[0] !== 'css') { |
72 | 72 | include.push(assetName); |
73 | 73 | } |
74 | 74 |
|
75 | | - (asset.children || []).forEach(child => { |
| 75 | + (asset.children || []).forEach(function(child) { |
76 | 76 | if (child && child._sourceMap && child._sourceMap.sources) { |
77 | | - sources.push(...child._sourceMap.sources); |
| 77 | + sources.push.apply(sources, child._sourceMap.sources); |
78 | 78 | } |
79 | 79 | }); |
80 | 80 |
|
81 | 81 | if (sources.includes(changedFile)) { |
82 | 82 | include.push(assetName); |
83 | 83 | } |
84 | | - }); |
85 | | - }); |
| 84 | + }, this); |
| 85 | + }, this); |
86 | 86 |
|
87 | 87 | var modules = stats.compilation.modules.find(child => child.reason); |
88 | 88 | var hash = stats.compilation.hash; |
|
0 commit comments