Skip to content

Commit

Permalink
correct out of scope variable
Browse files Browse the repository at this point in the history
  • Loading branch information
georgeweiler committed Dec 14, 2016
1 parent 2a273df commit 6cd9220
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/electrode-webpack-reporter/lib/reporter.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
s.parentNode.insertBefore(wf, s);
})();
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.1/socket.io.js"></script>
<script src="http://localhost:5000/socket.io/socket.io.js"></script>
<script>
if (!window.fetch) {
alert("Browser doesn't support fetch! Update your browser.");
Expand Down
6 changes: 3 additions & 3 deletions packages/electrode-webpack-reporter/lib/webpack-reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ function removeCwd(s) {
}

const reporterStats = require("../dist/server/stats.json");
let socketIO;

class WebpackReporter extends EventEmitter {
constructor() {
Expand All @@ -28,6 +27,7 @@ class WebpackReporter extends EventEmitter {
const distCss = Path.join(__dirname, "../dist/js", reporterStats.assetsByChunkName.main[1]);
this._reporterHtml = fs.readFileSync(Path.resolve(Path.join(__dirname, "reporter.html"))).toString()
.replace("{{CSS}}", removeCwd(distCss)).replace("{{JS}}", removeCwd(distJs));
this._socketIO = null;
}

apply(config) {
Expand All @@ -45,7 +45,7 @@ class WebpackReporter extends EventEmitter {
const warning = stats.hasWarnings() ? chalk.yellow(" WARNINGS") : "";
const but = (error || warning) && chalk.yellow(" but has") || "";
console.log(`webpack bundle is now VALID${but}${error}${warning}`);
socketIO ? socketIO.emit("hmr") : console.log(chalk.magenta(`webpack report is served from`), chalk.cyan(`http://${opt.host}:${opt.port}/reporter`));
this._socketIO ? this._socketIO.emit("hmr") : console.log(chalk.magenta(`webpack report is served from`), chalk.cyan(`http://${opt.host}:${opt.port}/reporter`));
} else {
console.log("webpack bundle is now INVALID");
}
Expand All @@ -60,7 +60,7 @@ class WebpackReporter extends EventEmitter {
const io = require('socket.io')(server);
server.listen(5000);
io.on("connection", (socket) => {
socketIO = socket;
this._socketIO = socket;
});
}

Expand Down

0 comments on commit 6cd9220

Please sign in to comment.