Fixed react hot reload plus a few other things

This commit is contained in:
Alex Mikhalev 2017-05-03 18:52:55 -06:00
parent 2000e0126c
commit 9cc2824298
2 changed files with 6 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import "paho-mqtt/mqttws31";
/// <reference path="./paho-mqtt.d.ts" /> /// <reference path="./paho-mqtt.d.ts" />
import "paho-mqtt/mqttws31";
import MQTT = Paho.MQTT; import MQTT = Paho.MQTT;
import { EventEmitter } from "events"; import { EventEmitter } from "events";
@ -15,7 +15,7 @@ export class MqttApiClient extends EventEmitter implements SprinklersApi {
constructor() { constructor() {
super(); super();
this.client = new Paho.MQTT.Client(location.hostname, 1884, MqttApiClient.newClientId()); this.client = new MQTT.Client(location.hostname, 1884, MqttApiClient.newClientId());
this.client.onMessageArrived = m => this.onMessageArrived(m); this.client.onMessageArrived = m => this.onMessageArrived(m);
this.client.onConnectionLost = e => this.onConnectionLost(e); this.client.onConnectionLost = e => this.onConnectionLost(e);
} }

View File

@ -5,9 +5,11 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = { module.exports = {
entry: [ entry: [
"react-hot-loader/patch", "react-hot-loader/patch",
"webpack-dev-server/client?http://localhost:8080",
"webpack/hot/only-dev-server",
"./app/script/index.tsx" "./app/script/index.tsx"
], ],
devtool: "sourcemap", devtool: "inline-source-map",
output: { output: {
path: path.resolve(__dirname, "dist"), path: path.resolve(__dirname, "dist"),
filename: "bundle.js" filename: "bundle.js"
@ -32,12 +34,7 @@ module.exports = {
new webpack.NamedModulesPlugin(), new webpack.NamedModulesPlugin(),
new webpack.HotModuleReplacementPlugin() new webpack.HotModuleReplacementPlugin()
], ],
externals: {
"react": "React",
"react-dom": "ReactDOM"
},
devServer: { devServer: {
hot: true, hot: true
contentBase: "./dist"
} }
}; };